home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / relnotes / nedit / nedit.doc < prev    next >
Text File  |  2001-04-17  |  170KB  |  3,599 lines

  1.                     NEdit Version 5.1.1, March 17, 2000
  2.  
  3. NEdit is a standard GUI (Graphical User Interface) style text editor for
  4. programs and plain-text files.  Users of Macintosh and MS Windows based text
  5. editors should find NEdit a familiar and comfortable environment.  NEdit
  6. provides all of the standard menu, dialog, editing, and mouse support, as well
  7. as all of the standard shortcuts to which the users of modern GUI based
  8. environments are accustomed.  For users of older style Unix editors, welcome to
  9. the world of mouse-based editing!
  10.  
  11. NEdit is freely distributed under the terms of the Gnu General Public License.
  12.  
  13.  
  14. INSTALLING NEDIT
  15.  
  16. NEdit is a single stand-alone executable file which can be installed by simply
  17. copying the appropriate executable "nedit" for your system.  Both sources and
  18. executables are available from http://nedit.org.  The optional "nc" (NEdit
  19. Client) program is also available for users who want to run nedit in
  20. client/server mode.
  21.  
  22.  
  23. GETTING STARTED
  24.  
  25. Help sections of interest to new users are listed under the "Basic Operation"
  26. heading in the top-level Help menu:
  27.  
  28.     Selecting Text
  29.     Finding and Replacing Text
  30.     Cut and Paste
  31.     Using the Mouse
  32.     Keyboard Shortcuts
  33.     Shifting and Filling
  34.  
  35. Programmers should also read the introductory section under the "Features for
  36. Programming" section:
  37.  
  38.     Programming with NEdit
  39.  
  40. If you get into trouble, the Undo command in the Edit menu can reverse any
  41. modifications that you make.  NEdit does not change the file you are editing
  42. until you tell it to Save.
  43.  
  44. Start NEdit by typing nedit.  You can specify a file or several files to edit
  45. on the command line, but you can also open them from inside of NEdit.  If you
  46. don't specify a file name to edit, NEdit will open a window titled "Untitled".
  47. You can create a new file by typing into this window and choosing Save or
  48. Save As... from the File menu.  There is no "main window" in NEdit, all
  49. editor windows are equivalent, and NEdit remains running as long as at least
  50. one window is open.
  51.  
  52. Editing an Existing File
  53.  
  54. To open an existing file, choose Open... from the file menu. Select the file
  55. that you want to open in the pop-up dialog that appears and click on OK.  You
  56. may open any number of files at the same time.  Each file will appear in its
  57. own editor window.  Using Open... rather than re-typing the NEdit command and
  58. running additional copies of NEdit, will give you quick access to all of the
  59. files you have open via the Windows menu, and ensure that you don't
  60. accidentally open the same file twice.  NEdit has no "main" window.  It remains
  61. running as long as at least one editor window is open.
  62.  
  63. Creating a New File
  64.  
  65. If you already have an empty (Untitled) window displayed, just begin typing in
  66. the window.  To create a new Untitled window, choose New from the File menu. 
  67. To give the file a name and save its contents to the disk, choose Save or Save
  68. As... from the File menu.
  69.  
  70. Backup Files
  71.  
  72. NEdit maintains periodic backups of the file you are editing so that you can
  73. recover the file in the event of a problem such as a system crash, network
  74. failure, or X server crash.  These files are saved under the name ~filename (on
  75. Unix) or _filename (on VMS), where filename is the name of the file you were
  76. editing.  If an NEdit process is killed, some of these backup files may remain
  77. in your directory.  (To remove one of these files on Unix, you may have to
  78. prefix the ~ (tilde) character with a (backslash) to prevent the shell from
  79. interpreting it as a special character.)
  80.  
  81. Shortcuts
  82.  
  83. As you become more familiar with NEdit, substitute the control and function
  84. keys shown on the right side of the menus for pulling down menus with the
  85. mouse.
  86.  
  87. Dialogs are also streamlined so you can enter information quickly and without
  88. using the mouse.  To move the keyboard focus around a dialog, use the tab and
  89. arrow keys.  One of the buttons in a dialog is usually drawn with a thick,
  90. indented, outline.  This button can be activated by pressing Return or Enter. 
  91. The Cancel or Dismiss button can be activated by pressing escape.  For example,
  92. to replace the string "thing" with "things" type:
  93.  
  94.     <ctrl-r>thing<tab>things<return>
  95.  
  96. To open a file named "whole_earth.c", type:
  97.  
  98.     <ctrl-o>who<return>
  99.  
  100. (how much of the filename you need to type depends on the other files in the
  101. directory).  See the section called Keyboard Shortcuts for more details.
  102.  
  103.  
  104. SELECTING TEXT
  105.  
  106. NEdit has two general types of selections, primary (highlighted text), and
  107. secondary (underlined text). Selections can cover either a simple range of text
  108. between two points in the file, or they can cover a rectangular area of the
  109. file.  Rectangular selections are only useful with non-proportional (fixed
  110. spacing) fonts.
  111.  
  112. To select text for copying, deleting, or replacing, press the left mouse button
  113. with the pointer at one end of the text you want to select, and drag it to the
  114. other end.  The text will become highlighted.  To select a whole word, double
  115. click (click twice quickly in succession).  Double clicking and then dragging
  116. the mouse will select a number of words.  Similarly, you can select a whole line
  117. or a number of lines by triple clicking or triple clicking and dragging. 
  118. Quadruple clicking selects the whole file.  After releasing the mouse button,
  119. you can still adjust a selection by holding down the shift key and dragging on
  120. either end of the selection.  To delete the selected text, press delete or
  121. backspace.  To replace it, begin typing.
  122.  
  123. To select a rectangle or column of text, hold the Ctrl key while dragging the
  124. mouse.  Rectangular selections can be used in any context that normal selections
  125. can be used, including cutting and pasting, filling, shifting, dragging, and
  126. searching.  Operations on rectangular selections automatically fill in tabs and
  127. spaces to maintain alignment of text within and to the right of the selection. 
  128. Note that the interpretation of rectangular selections by Fill Paragraph is
  129. slightly different from that of other commands, the section titled "Shifting and
  130. Filling" has details.
  131.  
  132. The middle mouse button can be used to make an additional selection (called the
  133. secondary selection).  As soon as the button is released, the contents of this
  134. selection will be copied to the insert position of the window where the mouse
  135. was last clicked (the destination window).  This position is marked by a caret
  136. shaped cursor when the mouse is outside of the destination window.  If there is
  137. a (primary) selection, adjacent to the cursor in the window, the new text will
  138. replace the selected text.  Holding the shift key while making the secondary
  139. selection will move the text, deleting it at the site of the secondary
  140. selection, rather than copying it.
  141.  
  142. Selected text can also be dragged to a new location in the file using the middle
  143. mouse button.  Holding the shift key while dragging the text will copy the
  144. selected text, leaving the original text in place.  Holding the control key will
  145. drag the text in overlay mode.
  146.  
  147. Normally, dragging moves text by removing it from the selected position at the
  148. start of the drag, and inserting it at a new position relative to to the mouse. 
  149. Dragging a block of text over existing characters, displaces the characters to
  150. the end of the selection.  In overlay mode, characters which are occluded by
  151. blocks of text being dragged are simply removed.  When dragging non-rectangular
  152. selections, overlay mode also converts the selection to rectangular form,
  153. allowing it to be dragged outside of the bounds of the existing text.
  154.  
  155. The section "Using the Mouse" sumarizes the mouse commands for making primary
  156. and secondary selections.  Primary selections can also be made via keyboard
  157. commands, see "Keyboard Shortcuts".
  158.  
  159.  
  160. CUTTING and PASTING
  161.  
  162. The easiest way to copy and move text around in your file or between windows, is
  163. to use the clipboard, an imaginary area that temporarily stores text and data. 
  164. The Cut command removes the selected text (see SELECTING TEXT) from your file
  165. and places it in the clipboard.  Once text is in the clipboard, the Paste
  166. command will copy it to the insert position in the current window.  For example,
  167. to move some text from one place to another, select it by dragging the mouse
  168. over it, choose Cut to remove it, click the pointer to move the insert point
  169. where you want the text inserted, then choose Paste to insert it.  Copy copies
  170. text to the clipboard without deleting it from your file.  You can also use the
  171. clipboard to transfer text to and from other Motif programs and X programs which
  172. make proper use of the clipboard.
  173.  
  174. There are many other methods for copying and moving text within NEdit windows
  175. and between NEdit and other programs.  The most common such method is clicking
  176. the middle mouse button to copy the primary selection (to the clicked
  177. position).  Copying the selection by clicking the middle mouse button in many
  178. cases is the only way to transfer data to and from many X programs.  Holding
  179. the Shift key while clicking the middle mouse button moves the text, deleting
  180. it from its original position, rather than copying it.  Other methods for
  181. transferring text include secondary selections, primary selection dragging,
  182. keyboard-based selection copying, and drag and drop.  These are described in
  183. detail in the sections: Selecting Text, Using the Mouse, and Keyboard
  184. Shortcuts.
  185.  
  186.  
  187. FINDING AND REPLACING TEXT
  188.  
  189. The Search menu contains a number of commands for finding and replacing text.
  190.  
  191. The Find... and Replace... commands present dialogs for entering text for
  192. searching and replacing.  These dialogs also allow you to choose whether you
  193. want the search to be sensitive to upper and lower case, or whether to use the
  194. standard Unix pattern matching characters (regular expressions).  Searches
  195. begin at the current text insertion position.
  196.  
  197. Find Again and Replace Again repeat the last find or replace command without
  198. prompting for search strings.  To selectively replace text, use the two
  199. commands in combination: Find Again, then Replace Again if the highlighted
  200. string should be replaced, or Find Again again to go to the next string.
  201.  
  202. Find Selection searches for the text contained in the current primary
  203. selection (see SELECTING TEXT).  The selected text does not have to be in the
  204. current editor window, it may even be in another program.  For example, if the
  205. word dog appears somewhere in a window on your screen, and you want to find it
  206. in the file you are editing, select the word dog by dragging the mouse across
  207. it, switch to your NEdit window and choose Find Selection from the Search
  208. menu.
  209.  
  210. Find Incremental is yet another variation on searching, where every character
  211. typed triggers a new search.  Incremental searching is generally the quickest
  212. way to find something in a file, because it gives you the immediate feedback of
  213. seeing how your search is progressing, so you never need to type more than the
  214. minimally sufficient search string to reach your target.
  215.  
  216. Searching Backwards
  217.  
  218. Holding down the shift key while choosing any of the search or replace
  219. commands from the menu (or using the keyboard shortcut), will search in the
  220. reverse direction.  Users who have set the search direction using the buttons
  221. in the search dialog, may find it a bit confusing that Find Again and Replace
  222. Again don't continue in the same direction as the original search (for
  223. experienced users, consistency of the direction implied by the shift key is
  224. more important).
  225.  
  226. Selective Replacement
  227.  
  228. To replace only some occurrences of a string within a file, choose Replace...
  229. from the Search menu, enter the string to search for and the string to
  230. substitute, and finish by pressing the Find button.  When the first occurrence
  231. is highlighted, use either Replace Again (^T) to replace it, or Find Again
  232. (^G) to move to the next occurrence without replacing it, and continue in such
  233. a manner through all occurrences of interest.
  234.  
  235. To replace all occurrences of a string within some range of text, select the
  236. range (see SELECTING TEXT), choose Replace... from the Search menu, type the
  237. string to search for and the string to substitute, and press the "R. in
  238. Selection" button in the dialog.  Note that selecting text in the Replace...
  239. dialog will unselect the text in the window.
  240.  
  241.  
  242. USING THE MOUSE
  243.  
  244. NEdit is one of the most mouse interactive text editors around, but you don't
  245. need to know all of the details below to be productive.  You can get by with
  246. just the left mouse button, clicking to move the cursor, and dragging to make a
  247. selection.
  248.  
  249. This section will make more sense if you also read the sections, SELECTING,
  250. and CUTTING, and PASTING, which explain the terminology of selections, i.e.
  251. what is meant by primary, secondary, rectangular, etc.
  252.  
  253. The general meaning of mouse buttons and modifier keys is as follows:
  254.  
  255.     Buttons
  256.  
  257.       Button 1 (left)    Cursor position and primary selection
  258.  
  259.       Button 2 (middle)  Secondary selections, and dragging and
  260.                      copying primary selection
  261.   
  262.       Button 3 (right)   Quick-access programmable menu and pan
  263.                          scrolling
  264.  
  265.     Modifier keys
  266.  
  267.       Shift   On primary selections, (left mouse button):
  268.              Extends selection to the mouse pointer
  269.               On secondary and copy operations, (middle):
  270.              Toggles between move and copy
  271.  
  272.       Ctrl    Makes selection rectangular or insertion
  273.               columnar
  274.  
  275.       Alt*    (on release) Exchange primary and secondary
  276.               selections.
  277.  
  278.  
  279. Left Mouse Button
  280.  
  281.     The left mouse button is used to position the cursor and to make primary
  282.     selections.
  283.  
  284.       Click             Moves the cursor
  285.  
  286.       Double Click    Selects a whole word
  287.  
  288.       Triple Click    Selects a whole line
  289.  
  290.       Quadruple Click    Selects the whole file
  291.  
  292.       Shift Click    Adjusts (extends or shrinks) the selection,
  293.                           or if there is no existing selection, begins a
  294.                           new selection between the cursor and the mouse.
  295.  
  296.       Ctrl+Shift+Click    Adjusts (extends or shrinks) the selection
  297.                        rectangularly.
  298.  
  299.       Drag        Selects text between where the mouse was pressed
  300.                           and where it was released.
  301.  
  302.       Ctrl+Drag         Selects rectangle between where the mouse was
  303.                           pressed and where it was released.
  304.  
  305.  
  306. Right Mouse Button
  307.  
  308.     The right mouse button posts a programmable menu for frequently used
  309.     commands.
  310.  
  311.       Click/Drag    Pops up the background menu (programmed from
  312.              Preferences -> Default Settings -> Customize
  313.              Menus -> Window Background).
  314.  
  315.       Ctrl+Drag     Pan scrolling.  Scrolls the window both
  316.              vertically and horizontally, as if you had
  317.              grabbed it with your mouse.
  318.  
  319.  
  320. Middle Mouse Button
  321.  
  322.    The middle mouse button is for making secondary selections, and copying
  323.    and dragging the primary selection
  324.  
  325.       Click       Copies the primary selection to the clicked position.
  326.  
  327.       Shift+Click  Moves the primary selection to the clicked position,
  328.             deleting it from its original position.
  329.  
  330.       Drag       1) Outside of the primary selection:
  331.                   Begins a secondary selection.
  332.             2) Inside of the primary selection:
  333.                   Moves the entire selection by dragging.
  334.  
  335.       Ctrl+Drag    1) Outside of the primary selection:
  336.                   Begins a rectangular secondary selection.
  337.             2) Inside of the primary selection:
  338.                   Drags the selection in overlay mode (see below).
  339.  
  340. When the mouse button is released after creating a secondary selection:
  341.  
  342.    No Modifiers  If there is a primary selection, replaces it with the
  343.             secondary selection.  Otherwise, inserts the secondary
  344.             selection at the cursor position.
  345.  
  346.    Shift     Move the secondary selection, deleting it from its
  347.             original position.  If there is a primary selection,
  348.             the move will replace the primary selection with the
  349.             secondary selection. Otherwise, moves the secondary
  350.             selection to to the cursor position.
  351.  
  352.    Alt*      Exchange the primary and secondary selections.
  353.  
  354.  
  355. While moving the primary selection by dragging with the middle mouse button:
  356.  
  357.    Shift   Leaves a copy of the original selection in place rather than
  358.           removing it or blanking the area.
  359.  
  360.    Ctrl    Changes from insert mode to overlay mode (see below).
  361.  
  362.    Escape  Cancels drag in progress.
  363.  
  364. Overlay Mode: Normally, dragging moves text by removing it from the selected
  365. position at the start of the drag, and inserting it at a new position relative
  366. to to the mouse.  When you drag a block of text over existing characters, the
  367. existing characters are displaced to the end of the selection.  In overlay
  368. mode, characters which are occluded by blocks of text being dragged are simply
  369. removed.  When dragging non-rectangular selections, overlay mode also converts
  370. the selection to rectangular form, allowing it to be dragged outside of the
  371. bounds of the existing text. 
  372.  
  373. * The Alt key may be labeled Meta or Compose-Character on some keyboards.  Some
  374. window managers, including default configurations of mwm, bind combinations of
  375. the Alt key and mouse buttons to window manager operations.  In NEdit, Alt is
  376. only used on button release, so regardless of the window manager bindings for
  377. Alt-modified mouse buttons, you can still do the corresponding NEdit operation
  378. by using the Alt key AFTER the initial mouse press, so that Alt is held while
  379. you release the mouse button.  If you find this difficult or annoying, you can
  380. re-configure most window managers to skip this binding, or you can re-configure
  381. NEdit to use a different key combination.
  382.  
  383.  
  384. KEYBOARD SHORTCUTS
  385.  
  386. Most of the keyboard shortcuts in NEdit are shown on the right hand sides of
  387. the pull-down menus.  However, there are more which are not as obvious.  These
  388. include; dialog button shortcuts; menu and dialog mnemonics; labeled keyboard
  389. keys, such as the arrows, page-up, page-down, and home; and optional Shift
  390. modifiers on accelerator keys, like [Shift]Ctrl+F.
  391.  
  392. Menu Accelerators
  393.  
  394. Pressing the key combinations shown on the right of the menu items is a
  395. shortcut for selecting the menu item with the mouse.  Some items have the shift
  396. key enclosed in brackets, such as [Shift]Ctrl+F.  This indicates that the shift
  397. key is optional.  In search commands, including the shift key reverses the
  398. direction of the search.  In Shift commands, it makes the command shift the
  399. selected text by a whole tab stop rather than by single characters.
  400.  
  401. Menu Mnemonics
  402.  
  403. Pressing the Alt key in combination with one of the underlined characters in
  404. the menu bar pulls down that menu.  Once the menu is pulled down, typing the
  405. underlined characters in a menu item (without the Alt key) activates that
  406. item.  With a menu pulled down, you can also use the arrow keys to select menu
  407. items, and the space or enter keys to activate them.
  408.  
  409. Keyboard Shortcuts within Dialogs
  410.  
  411. One button in a dialog is usually marked with a thick indented outline. 
  412. Pressing the Return or Enter key activates this button.
  413.  
  414. All dialogs have either a Cancel or Dismiss button.  This button can be
  415. activated by pressing the Escape (or Esc) key.
  416.  
  417. Pressing the tab key moves the keyboard focus to the next item in a dialog. 
  418. Within an associated group of buttons, the arrow keys move the focus among the
  419. buttons.  Shift+Tab moves backward through the items.
  420.  
  421. Most items in dialogs have an underline under one character in their name. 
  422. Pressing the Alt key along with this character, activates a button as if you
  423. had pressed it with the mouse, or moves the keyboard focus to the associated
  424. text field or list.
  425.  
  426. You can select items from a list by using the arrow keys to move the selection
  427. and space to select.
  428.  
  429. In file selection dialogs, you can type the beginning characters of the file
  430. name or directory in the list to select files
  431.  
  432. Labeled Function Keys 
  433.  
  434. The labeled function keys on standard workstation and PC keyboards, like the
  435. arrows, and page-up and page-down, are active in NEdit, though not shown in the
  436. pull-down menus. 
  437.  
  438. Holding down the control key while pressing a named key extends the scope of
  439. the action that it performs.  For example, Home normally moves the insert
  440. cursor the beginning of a line.  Ctrl+Home moves it to the beginning of the
  441. file. Backspace deletes one character, Ctrl+Backspace deletes one word. 
  442.  
  443. Holding down the shift key while pressing a named key begins or extends a
  444. selection.  Combining the shift and control keys combines their actions.  For
  445. example, to select a word without using the mouse, position the cursor at the
  446. beginning of the word and press Ctrl+Shift+RightArrow.  The Alt key modifies
  447. selection commands to make the selection rectangular. 
  448.  
  449. Under X and Motif, there are several levels of translation between keyboard
  450. keys and the actions they perform in a program.  The "KEY BINDING", and "X
  451. RESOURCES" sections below have more information on this subject.  Because of
  452. all of this configurability, and since keyboards and standards for the meaning
  453. of some keys vary from machine to machine, the mappings may be changed from the
  454. defaults listed below.
  455.  
  456. Modifier Keys (in general)
  457.  
  458.   Ctrl     Extends the scope of the action that the key would otherwise
  459.       perform.  For example, Home normally moves the insert cursor the
  460.       beginning of a line. Ctrl+Home moves it to the beginning of the
  461.       file.  Backspace deletes one character, Ctrl+ Backspace deletes
  462.       one word.
  463.  
  464.   Shift  Extends the selection to the cursor position. If there's no
  465.       selection, begins one between the old and new cursor positions.
  466.  
  467.   Alt     When modifying a selection, makes the selection rectangular.
  468.  
  469. (For the effects of modifier keys on mouse button presses, see the section
  470. titled "Using the Mouse")
  471.  
  472. All Keyboards
  473.  
  474.   Escape    Cancels operation in progress: menu selection, drag,
  475.           selection, etc.  Also equivalent to cancel button in
  476.           dialogs.
  477.  
  478.   Backspace    Delete the character before the cursor
  479.  
  480.   Ctrl+BS    Delete the word before the cursor
  481.  
  482.   Arrows
  483.  
  484.     Left    Move the cursor to the left one character
  485.  
  486.     Ctrl+Left   Move the cursor backward one word (Word delimiters
  487.             are settable, see CUSTOMIZATION)
  488.  
  489.     Right    Move the cursor to the right one character
  490.  
  491.     Ctrl+Right  Move the cursor forward one word
  492.  
  493.     Up      Move the cursor up one line
  494.  
  495.     Ctrl+Up    Move the cursor up one paragraph.  (Paragraphs are
  496.                 delimited by blank lines.)
  497.  
  498.     Down    Move the cursor down one line.
  499.  
  500.     Ctrl+Down    Move the cursor down one paragraph.
  501.  
  502.   Ctrl+Return    Return with automatic indent, regardless of the setting
  503.                 of Auto Indent.
  504.  
  505.   Shift+Return    Return without automatic indent, regardless of the
  506.           setting of Auto Indent.
  507.  
  508.   Ctrl+Tab    Insert an ascii tab character, without processing
  509.           emulated tabs.
  510.  
  511.   Alt+Ctrl+<c>    Insert the control-code equivalent of a key <c>
  512.  
  513.   Ctrl+/    Select everything (same as Select All menu item or ^A)
  514.  
  515.   Ctrl+\    Unselect
  516.  
  517.   Ctrl+U    Delete to start of line
  518.  
  519. PC Standard Keyboard
  520.  
  521.   Ctrl+Insert    Copy the primary selection to the clipboard (same as
  522.          Copy menu item or ^C) for compatibility with Motif
  523.          standard key binding
  524.  
  525.   Shift+Ctrl+
  526.   Insert    Copy the primary selection to the cursor location.
  527.  
  528.   Delete    Delete the character before the cursor. (Can be
  529.          configured to delete the character after the cursor,
  530.          see CUSTOMIZATION, and X RESOURCES)
  531.  
  532.  
  533.   Ctrl+Delete    Delete to end of line.
  534.  
  535.   Shift+Delete    Cut, remove the currently selected text and place it
  536.          in the clipboard. (same as Cut menu item or ^X) for
  537.          compatibility with Motif standard key binding.
  538.  
  539.   Shift+Ctrl+
  540.   Delete    Cut the primary selection to the cursor location.
  541.  
  542.   Home        Move the cursor to the beginning of the line.
  543.  
  544.   Ctrl+Home    Move the cursor to the beginning of the file.
  545.  
  546.   End        Move the cursor to the end of the line.
  547.  
  548.   Ctrl+End    Move the cursor to the end of the file.
  549.  
  550.   PageUp    Scroll and move the cursor up by one page.
  551.  
  552.   Ctrl+PageUp   Scroll and move the cursor left by one page.
  553.   
  554.   PageDown    Scroll and move the cursor down by one page.
  555.  
  556.   Ctrl+PageDown Scroll and move the cursor right by one page.
  557.  
  558.   F10        Make the menu bar active for keyboard input (Arrow
  559.           Keys, Return, Escape, and the Space Bar)
  560.  
  561.  
  562. Specialty Keyboards 
  563.  
  564. On machines with different styles of keyboards, generally, text editing actions
  565. are properly matched to the labeled keys, such as Remove, Next-screen, etc.. 
  566. If you prefer different key bindings, see the heading titled "Binding Keys to
  567. Actions" in the X RESOURCES section below.
  568.  
  569.  
  570. TEXT FILLING
  571.  
  572. Text filling using the Fill Paragraph command in the Edit menu is one of the
  573. most important concepts in NEdit.  And it will be well worth your while to
  574. understand how to use it properly.
  575.  
  576. In plain text files, unlike word-processor files, there is no way to tell which
  577. lines are continuations of other lines, and which lines are meant to be
  578. separate, because there is no distinction in meaning between newline characters
  579. which separate lines in a paragraph, and ones which separate paragraphs from
  580. other text.  This makes it impossible for a text editor like NEdit to tell
  581. parts of the text which belong together as a paragraph from carefully arranged
  582. individual lines.
  583.  
  584. In continuous wrap mode, lines automatically wrap and unwrap themselves to
  585. line up properly at the right margin.  In this mode, you simply omit the
  586. newlines within paragraphs and let NEdit make the line breaks as needed. 
  587. Unfortunately, continuous wrap mode is not appropriate in the majority of
  588. situations, because files with extremely long lines are not common under Unix
  589. and may not be compatible with all tools, and because you can't achieve
  590. effects like indented sections, columns, or program comments, and still take
  591. advantage of the automatic wrapping.
  592.  
  593. Without continuous wrapping, paragraph filling is not entirely automatic. 
  594. Auto-Newline wrapping keeps paragraphs lined up as you type, but once entered,
  595. NEdit can no longer distinguish newlines which join wrapped text, and newlines
  596. which must be preserved.  Therefore, editing in the middle of a paragraph will
  597. often leave the right margin messy and uneven.
  598.  
  599. Since NEdit can't act automatically to keep your text lined up, you need to
  600. tell it explicitly where to operate, and that is what Fill Paragraph is for. 
  601. It arranges lines to fill the space between two margins, wrapping the lines
  602. neatly at word boundaries.  Normally, the left margin for filling is inferred
  603. from the text being filled.  The first line of each paragraph is considered
  604. special, and its left indentation is maintained separately from the remaining
  605. lines (for leading indents, bullet points, numbered paragraphs, etc.). 
  606. Otherwise, the left margin is determined by the furthest left non-whitespace
  607. character.  The right margin is either the Wrap Margin, set in the preferences
  608. menu (by default, the right edge of the window), or can also be chosen on the
  609. fly by using a rectangular selection (see below).
  610.  
  611. There are three ways to use Fill Paragraph.  The simplest is, while you are
  612. typing text, and there is no selection, simply select Fill Paragraph (or type
  613. Ctrl+J), and NEdit will arrange the text in the paragraph adjacent to the
  614. cursor.  A paragraph, in this case, means an area of text delimited by blank
  615. lines.
  616.  
  617. The second way to use Fill Paragraph is with a selection.  If you select a
  618. range of text and then chose Fill Paragraph, all of the text in the selection
  619. will be filled.  Again, continuous text between blank lines is interpreted as
  620. paragraphs and filled individually, respecting leading indents and blank lines.
  621.  
  622. The third, and most versitile, way to use Fill Paragraph is with a rectangular
  623. selection.  Fill Paragraph treats rectangular selections differently from other
  624. commands.  Instead of simply filling the text inside the rectangular selection,
  625. NEdit interprets the right edge of the selection as the requested wrap margin. 
  626. Text to the left of the selection is not disturbed (the usual interpretation of
  627. a rectangular selection), but text to the right of the selection is included in
  628. the operation and is pulled in to the selected region.  This method enables you
  629. to fill text to an arbitrary right margin, without going back and forth to the
  630. wrap-margin dialog, as well as to exclude text to the left of the selection
  631. such as comment bars or other text columns.
  632.  
  633. SHIFT LEFT, SHIFT RIGHT
  634.  
  635. While shifting blocks of text is most important for programmers (See FEATURES
  636. FOR PROGRAMMING), it is also useful for other tasks, such as creating indented
  637. paragraphs. 
  638.  
  639. To shift a block of text one tab stop to the right, select the text, then
  640. choose Shift Right from the Edit menu.  Note that the accelerator keys for
  641. these menu items are Ctrl+9 and Ctrl+0, which correspond to the right and left
  642. parenthesis on most keyboards.  Remember them as adjusting the text in the
  643. direction pointed to by the parenthesis character.  Holding the Shift key while
  644. selecting either Shift Left or Shift Right will shift the text by one character.
  645.  
  646. It is also possible to shift blocks of text by selecting the text
  647. rectangularly, and dragging it left or right (and up or down as well).  Using
  648. a rectangular selection also causes tabs within the selection to be
  649. recalculated and substituted, such that the non-whitespace characters remain
  650. stationary with respect to the selection.
  651.  
  652. FILE FORMAT
  653.  
  654. While plain-text is probably the simplest and most interchangeable file format
  655. in the computer world, there is still variation in what plain-text means from
  656. system to system.  Plain-text files can differ in character set, line
  657. termination, and wrapping.
  658.  
  659. While character set differences are the most obvious and pose the most
  660. challenge to portability, they affect nedit only indirectly via the same font
  661. and localization mechanisms common to all X applications.  If your system is
  662. set up properly, you will probably never see character-set related problems in
  663. nedit.  NEdit can not display Unicode text files, or any multi-byte character
  664. set.
  665.  
  666. The primary difference between an MS DOS format file and a Unix format file, is
  667. how the lines are terminated.  Unix uses a single newline character.  MS DOS
  668. uses a carriage-return and a newline.  NEdit can read and write both file
  669. formats, but internally, it uses the single character Unix standard.  NEdit
  670. auto-detects MS DOS format files based on the line termination at the start of
  671. the file.  Files are judged to be DOS format if all of the first five line
  672. terminators, within a maximum range, are DOS-style.  To change the format in
  673. which nedit writes a file from DOS to Unix or visa versa, use the Save As...
  674. command and check or un-check the MS DOS Format button.
  675.  
  676. Wrapping within text files can vary among individual users, as well as from
  677. system to system.  Both Windows and MacOS make frequent use of plain text files
  678. with no implicit right margin.  In these files, wrapping is determined by the
  679. tool which displays them.  Files of this style also exist on Unix systems,
  680. despite the fact that they are not supported by all Unix utilities.  To display
  681. this kind of file properly in NEdit, you have to select the wrap style called
  682. Continuous.  Wrapping modes are discussed in the sections: Customizing ->
  683. Preferences, and Basic Operation -> Shifting and Filling.
  684.  
  685. The last and most minute of format differences is the terminating newline. 
  686. NEdit, like vi and approximately half of Unix editors, enforces a final
  687. terminating newline on all of the files that it writes.  NEdit does this
  688. because some Unix compilers and utilities require it, and fail in various ways
  689. on files which do not have it.  Emacs does not enforce this rule.  Users are
  690. divided on which is best.
  691.  
  692. REGULAR EXPRESSIONS
  693.  
  694. Regular expressions (regex's) are useful as a way to match inexact sequences of
  695. characters.  They can be used in the `Find...' and `Replace...' search dialogs
  696. and are at the core of Color Syntax Highlighting patterns.  To specify a
  697. regular expression in a search dialog, simply click on the `Regular Expression'
  698. radio button in the dialog.
  699.  
  700. A regex is a specification of a pattern to be matched in the searched text. 
  701. This pattern consists of a sequence of tokens, each being able to match a
  702. single character or a sequence of characters in the text, or assert that a
  703. specific position within the text has been reached (the latter is called an
  704. anchor.)  Tokens (also called atoms) can be modified by adding one of a number
  705. of special quantifier tokens immediately after the token.  A quantifier token
  706. specifies how many times the previous token must be matched (see below.)
  707.  
  708. Tokens can be grouped together using one of a number of grouping constructs,
  709. the most common being plain parentheses.  Tokens that are grouped in this way
  710. are also collectively considered to be a regex atom, since this new larger atom
  711. may also be modified by a quantifier.
  712.  
  713. A regex can also be organized into a list of alternatives by separating each
  714. alternative with pipe characters, `|'.  This is called alternation.  A match
  715. will be attempted for each alternative listed, in the order specified, until a
  716. match results or the list of alternatives is exhausted (see "Alternation"
  717. below.)
  718.  
  719. The Dot Meta Character
  720.  
  721. If an un-escaped dot (`.') appears in a regex, it means to match any character
  722. exactly once.  By default dot will not match a newline character, but this
  723. behavior can be changed (see help topic "Grouping", item "Matching Newlines".)
  724.  
  725. Character Classes
  726.  
  727. A character class, or range, matches exactly one character of text, but the
  728. candidates for matching are limited to those specified by the class.  Classes
  729. come in two flavors as described below:
  730.  
  731.    [...]   Regular class, match only characters listed.
  732.    [^...]  Negated class, match only characters NOT listed.
  733.  
  734. As with the dot token, by default negated character classes do not match
  735. newline, but can be made to do so.
  736.  
  737. The characters that are considered special within a class specification are
  738. different than the rest of regex syntax as follows. If the first character in a
  739. class is the `]' character (second character if the first character is `^') it
  740. is a literal character and part of the class character set.  This also applies
  741. if the first or last character is `-'.  Outside of these rules, two characters
  742. separated by `-' form a character range which includes all the characters
  743. between the two characters as well.  For example, `[^f-j]' is the same as
  744. `[^fghij]' and means to match any character that is not `f', `g', `h', `i', or
  745. `j'.
  746.  
  747. Anchors
  748.  
  749. Anchors are assertions that you are at a very specific position within the
  750. search text.  NEdit regular expressions support the following anchor tokens:
  751.  
  752.    ^    Beginning of line
  753.    $    End of line
  754.    <    Left word boundary
  755.    >    Right word boundary
  756.    \B   Not a word boundary
  757.  
  758. Note that the \B token ensures that the left and right characters are both
  759. delimiter characters, or that both left and right characters are non-delimiter
  760. characters.  Currently word anchors check only one character, e.g. the left
  761. word anchor `<' only asserts that the left character is a word delimiter
  762. character.  Similarly the right word anchor checks the right character.
  763.  
  764. Quantifiers
  765.  
  766. Quantifiers specify how many times the previous regular expression atom may be
  767. matched in the search text.  Some quantifiers can produce a large performance
  768. penalty, and can in some instances completely lock up NEdit.  To prevent this,
  769. avoid nested quantifiers, especially those of the maximal matching type (see
  770. below.)
  771.  
  772. The following quantifiers are maximal matching, or "greedy", in that they match
  773. as much text as possible.
  774.  
  775.    *   Match zero or more
  776.    +   Match one  or more
  777.    ?   Match zero or one
  778.  
  779. The following quantifiers are minimal matching, or "lazy", in that they match
  780. as little text as possible.
  781.  
  782.    *?   Match zero or more
  783.    +?   Match one  or more
  784.    ??   Match zero or one
  785.  
  786. One final quantifier is the counting quantifier, or brace quantifier. It takes
  787. the following basic form:
  788.  
  789.    {min,max}  Match from `min' to `max' times the
  790.               previous regular expression atom.
  791.  
  792. If `min' is omitted, it is assumed to be zero.  If `max' is omitted, it is
  793. assumed to be infinity.  Whether specified or assumed, `min' must be less than
  794. or equal to `max'.  Note that both `min' and `max' are limited to 65535.  If
  795. both are omitted, then the construct is the same as `*'.   Note that `{,}' and
  796. `{}' are both valid brace constructs.  A single number appearing without a
  797. comma, e.g. `{3}' is short for the `{min,min}' construct, or to match exactly
  798. `min' number of times.
  799.  
  800. The quantifiers `{1}' and `{1,1}' are accepted by the syntax, but are optimized
  801. away since they mean to match exactly once, which is redundant information. 
  802. Also, for efficiency, certain combinations of `min' and `max' are converted to
  803. either `*', `+', or `?' as follows:
  804.  
  805.    {} {,} {0,}    *
  806.    {1,}           +
  807.    {,1} {0,1}     ?
  808.  
  809. Note that {0} and {0,0} are meaningless and will generate an error message at
  810. regular expression compile time.
  811.  
  812. Brace quantifiers can also be "lazy".  For example {2,5}? would try to match 2
  813. times if possible, and will only match 3, 4, or 5 times if that is what is
  814. necessary to achieve an overall match.
  815.  
  816. Alternation
  817.  
  818. A series of alternative patterns to match can be specified by separating them
  819. with vertical pipes, `|'.  An example of alternation would be `a|be|sea'.  This
  820. will match `a', or `be', or `sea'.  Each alternative can be an arbitrarily
  821. complex regular expression.  The alternatives are attempted in the order
  822. specified.  An empty alternative can be specified if desired, e.g. `a|b|'. 
  823. Since an empty alternative can match nothingness (the empty string), this
  824. guarantees that the expression will match.
  825.  
  826. Comments
  827.  
  828. Comments are of the form `(?#<comment text>)' and can be inserted anywhere and
  829. have no effect on the execution of the regular expression.  They can be handy
  830. for documenting very complex regular expressions.  Note that a comment begins
  831. with `(?#' and ends at the first occurrence of an ending parenthesis, or the
  832. end of the regular expression... period.  Comments do not recognize any escape
  833. sequences.
  834.  
  835. Special Control Characters
  836.  
  837. In a regex, most ordinary characters match themselves.  For example, `ab%'
  838. would match anywhere `a' followed by `b' followed by `%' appeared in the text. 
  839. However, there are some special characters that are difficult or impossible to
  840. type.  Many of these characters have escape sequences (simple characters
  841. preceded by `\') assigned to represent them.  NEdit recognizes the following
  842. special character escape sequences:
  843.  
  844.    \a  alert (bell)
  845.    \b  backspace
  846.    \e  ASCII escape character (***)
  847.    \f  form feed (new page)
  848.    \n  newline
  849.    \r  carriage return
  850.    \t  horizontal tab
  851.    \v  vertical tab
  852.  
  853.    *** For environments that use the EBCDIC character set,
  854.        when compiling NEdit set the EBCDIC_CHARSET compiler
  855.        symbol to get the EBCDIC equivalent escape
  856.        character.)
  857.  
  858. Escaped Meta Characters
  859.  
  860. Characters that have special meaning to the regex syntax are called meta
  861. characters.  NEdit provides the following escape sequences so that characters
  862. that are used by the regex syntax can be specified as ordinary characters and
  863. not interpreted as meta characters.
  864.  
  865.    \(  \)  \-  \[  \]  \<  \>  \{  \}
  866.    \.  \|  \^  \$  \*  \+  \?  \&  \\
  867.  
  868. Octal and Hex Escape Sequences
  869.  
  870. Any ASCII (or EBCDIC) character, except null, can be specified by using either
  871. an octal escape or a hexadecimal escape, each beginning with \0 or \x (or \X)
  872. respectively.  For example, \052 and \X2A both specify the `*' character. 
  873. Escapes for null (\00 or \x0) are not valid and will generate an error
  874. message.  Also, any escape that exceeds \0377 or \xFF will either cause an
  875. error or have any additional character(s) interpreted literally. For example,
  876. \0777 will be interpreted as \077 (a `?' character) followed by `7' since \0777
  877. is greater than \0377.
  878.  
  879. An invalid digit will also end an octal or hexadecimal escape.  For example,
  880. \091 will cause an error since `9' is not within an octal escape's range of
  881. allowable digits (0-7) and truncation before the `9' yields \0 which is
  882. invalid.
  883.  
  884. Shortcut Escapes
  885.  
  886. NEdit defines some escape sequences that are handy shortcuts for commonly used
  887. character classes.
  888.  
  889.    \d  digits            0-9
  890.    \l  letters           a-z and A-Z
  891.    \s  whitespace        \t, \r, \v, \f, and space
  892.    \w  word characters   a-z, A-Z, 0-9, and underscore, `_'
  893.  
  894. \D, \L, \S, and \W are the same as the lowercase versions except that the
  895. resulting character class is negated.  For example, \d is equivalent to
  896. `[0-9]', while \D is equivalent to `[^0-9]'.
  897.  
  898. These escape sequences can also be used within a character class.  For example,
  899. `[\l_]' is the same as `[a-zA-Z_]'.  The escape sequences for special
  900. characters, and octal and hexadecimal escapes are also valid within a class.
  901.  
  902. Word Delimiter Tokens
  903.  
  904. Although not strictly a character class, the following escape sequences behave
  905. similarly to character classes:
  906.  
  907.    \y   Word delimiter character
  908.    \Y   Not a word delimiter character
  909.  
  910. The `\y' token matches any single character that is one of the characters that
  911. NEdit recognizes as a word delimiter character, while the `\Y' token matches
  912. any character that is NOT a word delimiter character.  Word delimiter
  913. characters are dynamic in nature, meaning that the user can change them through
  914. preference settings.  For this reason, they must be handled differently by the
  915. regular expression engine.  As a consequence of this, `\y' and `\Y' can not be
  916. used within a character class specification.
  917.  
  918. Capturing Parentheses
  919.  
  920. Capturing Parentheses are of the form `(<regex>)' and can be used to group
  921. arbitrarily complex regular expressions.  Parentheses can be nested, but the
  922. total number of parentheses, nested or otherwise, is limited to 50 pairs.  The
  923. text that is matched by the regular expression between a matched set of
  924. parentheses is captured and available for text substitutions and backreferences
  925. (see below.)  Capturing parentheses carry a fairly high overhead both in terms
  926. of memory used and execution speed, especially if quantified by `*' or `+'.
  927.  
  928. Non-Capturing Parentheses
  929.  
  930. Non-Capturing Parentheses are of the form `(?:<regex>)' and facilitate grouping
  931. only and do not incur the overhead of normal capturing parentheses.  They
  932. should not be counted when determining numbers for capturing parentheses which
  933. are used with backreferences and substitutions.  Because of the limit on the
  934. number of capturing parentheses allowed in a regex, it is advisable to use
  935. non-capturing parentheses when possible.
  936.  
  937. Positive Look-Ahead
  938.  
  939. Positive look-ahead constructs are of the form `(?=<regex>)' and implement a
  940. zero width assertion of the enclosed regular expression.  In other words, a
  941. match of the regular expression contained in the positive look-ahead construct
  942. is attempted.  If it succeeds, control is passed to the next regular expression
  943. atom, but the text that was consumed by the positive look-ahead is first
  944. unmatched (backtracked) to the place in the text where the positive look-ahead
  945. was first encountered.
  946.  
  947. One application of positive look-ahead is the manual implementation of a first
  948. character discrimination optimization.  You can include a positive look-ahead
  949. that contains a character class which lists every character that the following
  950. (potentially complex) regular expression could possibly start with.  This will
  951. quickly filter out match attempts that can not possibly succeed.
  952.  
  953. Negative Look-Ahead
  954.  
  955. Negative look-ahead takes the form `(?!<regex>)' and is exactly the same as
  956. positive look-ahead except that the enclosed regular expression must NOT
  957. match.  This can be particularly useful when you have an expression that is
  958. general, and you want to exclude some special cases.  Simply precede the
  959. general expression with a negative look-ahead that covers the special cases
  960. that need to be filtered out.
  961.  
  962. Case Sensitivity
  963.  
  964. There are two parenthetical constructs that control case sensitivity:
  965.  
  966.    (?i<regex>)   Case insensitive; `AbcD' and `aBCd' are equivalent.
  967.  
  968.    (?I<regex>)   Case sensitive;   `AbcD' and `aBCd' are different.
  969.  
  970. Regular expressions are case sensitive by default, i.e `(?I<regex>)' is
  971. assumed.  All regular expression token types respond appropriately to case
  972. insensitivity including character classes and backreferences.  There is some
  973. extra overhead involved when case insensitivity is in effect, but only to the
  974. extent of converting each character compared to lower case.
  975.  
  976. Matching Newlines
  977.  
  978. NEdit regular expressions by default handle the matching of newlines in a way
  979. that should seem natural for most editing tasks.  There are situations,
  980. however, that require finer control over how newlines are matched by some
  981. regular expression tokens.
  982.  
  983. By default, NEdit regular expressions will NOT match a newline character for
  984. the following regex tokens: dot (`.'); a negated character class (`[^...]');
  985. and the following shortcuts for character classes:
  986.  
  987.    `\d', `\D', `\l', `\L', `\s', `\S', `\w', `\W', `\Y'
  988.  
  989. The matching of newlines can be controlled for the `.' token, negated character
  990. classes, and the `\s' and `\S' shortcuts by using one of the following
  991. parenthetical constructs:
  992.  
  993.    (?n<regex>)  `.', `[^...]', `\s', `\S' match newlines
  994.  
  995.    (?N<regex>)  `.', `[^...]', `\s', `\S' don't match newlines
  996.  
  997. `(?N<regex>)' is the default behavior.
  998.  
  999. Notes on New Parenthetical Constructs
  1000.  
  1001. Except for plain parentheses, none of the parenthetical constructs capture
  1002. text.  If that is desired, the construct must be wrapped with capturing
  1003. parentheses, e.g. `((?i<regex))'.
  1004.  
  1005. All parenthetical constructs can be nested as deeply as desired, except for
  1006. capturing parentheses which have a limit of 50 sets of parentheses, regardless
  1007. of nesting level.
  1008.  
  1009. Back References
  1010.  
  1011. Backreferences allow you to match text captured by a set of capturing
  1012. parenthesis at some latter position in your regular expression.  A
  1013. backreference is specified using a single backslash followed by a single digit
  1014. from 1 to 9 (example: \3).  Backreferences have similar syntax to substitutions
  1015. (see below), but are different from substitutions in that they appear within
  1016. the regular expression, not the substitution string. The number specified with
  1017. a backreference identifies which set of text capturing parentheses the
  1018. backreference is associated with. The text that was most recently captured by
  1019. these parentheses is used by the backreference to attempt a match.  As with
  1020. substitutions, open parentheses are counted from left to right beginning with
  1021. 1.  So the backreference `\3' will try to match another occurrence of the text
  1022. most recently matched by the third set of capturing parentheses.  As an
  1023. example, the regular expression `(\d)\1' could match `22', `33', or `00', but
  1024. wouldn't match `19' or `01'.
  1025.  
  1026. A backreference must be associated with a parenthetical expression that is
  1027. complete.  The expression `(\w(\1))' contains an invalid backreference since
  1028. the first set of parentheses are not complete at the point where the
  1029. backreference appears.
  1030.  
  1031. Substitution
  1032.  
  1033. Substitution strings are used to replace text matched by a set of capturing
  1034. parentheses.  The substitution string is mostly interpreted as ordinary text
  1035. except as follows.
  1036.  
  1037. The escape sequences described above for special characters, and octal and
  1038. hexadecimal escapes are treated the same way by a substitution string. When the
  1039. substitution string contains the `&' character, NEdit will substitute the
  1040. entire string that was matched by the `Find...' operation. Any of the first
  1041. nine sub-expressions of the match string can also be inserted into the
  1042. replacement string.  This is done by inserting a `\' followed by a digit from 1
  1043. to 9 that represents the string matched by a parenthesized expression within
  1044. the regular expression.  These expressions are numbered left-to-right in order
  1045. of their opening parentheses.
  1046.  
  1047. The capitalization of text inserted by `&' or `\1', `\2', ... `\9' can be
  1048. altered by preceding them with `\U', `\u', `\L', or `\l'.  `\u' and `\l' change
  1049. only the first character of the inserted entity, while `\U' and `\L' change the
  1050. entire entity to upper or lower case, respectively.
  1051.  
  1052. Substitutions
  1053.  
  1054. Regular expression substitution can be used to program automatic editing
  1055. operations.  For example, the following are search and replace strings to find
  1056. occurrences of the `C' language subroutine `get_x', reverse the first and
  1057. second parameters, add a third parameter of NULL, and change the name to
  1058. `new_get_x':
  1059.  
  1060.    Search string:   `get_x *\( *([^ ,]*), *([^\)]*)\)'
  1061.    Replace string:  `new_get_x(\2, \1, NULL)'
  1062.  
  1063. Ambiguity
  1064.  
  1065. If a regular expression could match two different parts of the text, it will
  1066. match the one which begins earliest.  If both begin in the same place but match
  1067. different lengths, or match the same length in different ways, life gets
  1068. messier, as follows.
  1069.  
  1070. In general, the possibilities in a list of alternatives are considered in
  1071. left-to-right order.  The possibilities for `*', `+', and `?' are considered
  1072. longest-first, nested constructs are considered from the outermost in, and
  1073. concatenated constructs are considered leftmost-first. The match that will be
  1074. chosen is the one that uses the earliest possibility in the first choice that
  1075. has to be made.  If there is more than one choice, the next will be made in the
  1076. same manner (earliest possibility) subject to the decision on the first
  1077. choice.  And so forth.
  1078.  
  1079. For example, `(ab|a)b*c' could match `abc' in one of two ways.  The first
  1080. choice is between `ab' and `a'; since `ab' is earlier, and does lead to a
  1081. successful overall match, it is chosen.  Since the `b' is already spoken for,
  1082. the `b*' must match its last possibility, the empty string, since it must
  1083. respect the earlier choice.
  1084.  
  1085. In the particular case where no `|'s are present and there is only one `*',
  1086. `+', or `?', the net effect is that the longest possible match will be chosen. 
  1087. So `ab*', presented with `xabbbby', will match `abbbb'.  Note that if `ab*' is
  1088. tried against `xabyabbbz', it will match `ab' just after `x', due to the
  1089. begins-earliest rule.  (In effect, the decision on where to start the match is
  1090. the first choice to be made, hence subsequent choices must respect it even if
  1091. this leads them to less-preferred alternatives.)
  1092.  
  1093. Examples:
  1094.  
  1095. o  Entire line.
  1096.  
  1097.   ^.*$
  1098.  
  1099. o  Blank lines.
  1100.  
  1101.   ^$
  1102.  
  1103. o  Whitespace on a line.
  1104.  
  1105.   \s+
  1106.  
  1107. o  Whitespace across lines.
  1108.  
  1109.   (?n\s+)
  1110.  
  1111. o  Whitespace that spans at least two lines.  Note minimal
  1112.    matching `*?' quantifier.
  1113.  
  1114.   (?n\s*?\n\s*)
  1115.  
  1116. o  IP address (not robust.)
  1117.  
  1118.   (?:\d{1,3}(?:\.\d{1,3}){3})
  1119.  
  1120. o  Two character US Postal state abbreviations (includes
  1121.    territories.)
  1122.  
  1123.   [ACDF-IK-PR-W][A-Z]
  1124.  
  1125. o  Web addresses
  1126.  
  1127.   (?:http://)?www\.\S+
  1128.  
  1129. o  Case insensitive double words across line breaks.
  1130.  
  1131.   (?i(?n<(\S+)\s+\1>))
  1132.  
  1133. o  Upper case words with possible punctuation.
  1134.  
  1135.   <[A-Z][^a-z\s]*>
  1136.   
  1137. References
  1138.  
  1139. An excellent book on the care and feeding of regular expressions is
  1140.  
  1141.     "Mastering Regular Expressions"
  1142.     Jeffrey E. F. Friedl
  1143.     (c) 1997, O'Reilly & Associates
  1144.     ISBN 1-56592-257-3
  1145.  
  1146.  
  1147. FEATURES FOR PROGRAMMERS
  1148.  
  1149. Though general in appearance, NEdit has many features intended specifically
  1150. for programmers.  Programming-related topics are listed here, and in the next
  1151. four sections: TABS AND TAB EMULATION, AUTOMATIC INDENT, SYNTAX HIGHLIGHTING,
  1152. and FINDING SUBROUTINE AND DATA DECLARATIONS (CTAGS).
  1153.  
  1154. Language Modes
  1155.  
  1156. When nedit initially reads a file, it attempts to determine whether the file is
  1157. in one of the computer languages that it knows about.  Knowing what language a
  1158. file is written in allows NEdit to assign highlight patterns and smart indent
  1159. macros, and to set language specific preferences like word delimiters, tab
  1160. emulation, and auto-indent.  Language mode can be recognized from both the file
  1161. name and from the first 200 characters of content.  Language mode recognition
  1162. and language-specific preferences are configured in: Preferences -> Default
  1163. Settings -> Language Modes....
  1164.  
  1165. You can set the language mode manually for a window, by selecting it from the
  1166. menu: Preferences -> Language Modes.
  1167.  
  1168. Line Numbers
  1169.  
  1170. To find a particular line in a source file by line number, choose Goto Line
  1171. #... from the Search menu.  You can also directly select the line number text
  1172. in the compiler message in the terminal emulator window (xterm, decterm,
  1173. winterm, etc.) where you ran the compiler, and choose Goto Selected from the
  1174. Search menu.
  1175.  
  1176. To find out the line number of a particular line in your file, turn on
  1177. Statistics Line in the Preferences menu and position the insertion point
  1178. anywhere on the line.  The statistics line continuously updates the line number
  1179. of the line containing the cursor.
  1180.  
  1181. Matching Parentheses
  1182.  
  1183. To help you inspect nested parentheses, brackets, braces, quotes, and other
  1184. characters, NEdit has both an automatic parenthesis matching mode, and a Find
  1185. Matching command.  Automatic parenthesis matching is activated when you type,
  1186. or move the insertion cursor after a parenthesis, bracket, or brace.  It
  1187. momentarily highlights the matching character if that character is visible in
  1188. the window.  To find a matching character anywhere in the file, select it or
  1189. position the cursor after it, and choose Find Matching from the Search menu. 
  1190. If the character matches itself, such as a quote or slash, select the first
  1191. character of the pair.  NEdit will match {, (, [, <, ", ', `, /, and \.
  1192.  
  1193. Opening Included Files
  1194.  
  1195. The Open Selected command in the File menu understands the C preprocessor's
  1196. #include syntax, so selecting an #include line and invoking Open Selected will
  1197. generally find the file referred to, unless doing so depends on the settings of
  1198. compiler switches or other information not available to NEdit.
  1199.  
  1200. Interface to Programming Tools
  1201.  
  1202. Integrated software development environments such as SGI's CaseVision and
  1203. Centerline Software's Code Center, can be interfaced directly with NEdit via
  1204. the client server interface.  These tools allow you to click directly on
  1205. compiler and runtime error messages and request NEdit to open files, and select
  1206. lines of interest.  The easiest method is usually to use the tool's interface
  1207. for character-based editors like vi, to invoke nc, but programatic interfaces
  1208. can also be derived using the source code for nc.
  1209.  
  1210. There are also some simple compile/review, grep, ctree, and ctags browsers
  1211. available in the NEdit contrib directory on ftp.fnal.gov.
  1212.  
  1213.  
  1214. TABS AND TAB EMULATION
  1215.  
  1216. Tabs are important for programming in languages which use indentation to show
  1217. nesting, as short-hand for producing white-space for leading indents.  As a
  1218. programmer, you have to decide how to use indentation, and how or whether tab
  1219. characters map to your indentation scheme.
  1220.  
  1221. Ideally, tab characters map directly to the amount of indent that you use to
  1222. distinguish nesting levels in your code.  Unfortunately, the Unix standard for
  1223. interpretation of tab characters is eight characters (probably dating back to
  1224. mechanical capabilities of the original teletype), which is usually too coarse
  1225. for a single indent.
  1226.  
  1227. Most text editors, NEdit included, allow you to change the interpretation of
  1228. the tab character, and many programmers take advantage of this, and set their
  1229. tabs to 3 or 4 characters to match their programming style.  In NEdit you set
  1230. the hardware tab distance in Preferences -> Tabs... for the current window, or
  1231. Preferences -> Default Settings -> Tabs... (general), or Preferences -> Default
  1232. Settings -> Language Modes... (language-specific) to change the defaults for
  1233. future windows.
  1234.  
  1235. Changing the meaning of the tab character makes programming much easier while
  1236. you're in the editor, but can cause you headaches outside of the editor,
  1237. because there is no way to pass along the tab setting as part of a plain-text
  1238. file.  All of the other tools which display, print, and otherwise process your
  1239. source code have to be made aware of how the tabs are set, and must be able to
  1240. handle the change.  Non-standard tabs can also confuse other programmers, or
  1241. make editing your code difficult for them if their text editors don't support
  1242. changes in tab distance.
  1243.  
  1244. Emulated Tabs
  1245.  
  1246. An alternative to changing the interpretation of the tab character is tab
  1247. emulation.  In the Tabs... dialog(s), turning on Emulated Tabs causes the Tab
  1248. key to insert the correct number of spaces and/or tabs to bring the cursor the
  1249. next emulated tab stop, as if tabs were set at the emulated tab distance rather
  1250. than the hardware tab distance.  Backspacing immediately after entering an
  1251. emulated tab will delete the fictitious tab as a unit, but as soon as you move
  1252. the cursor away from the spot, NEdit will forget that the collection of spaces
  1253. and tabs is a tab, and will treat it as separate characters.  To enter a real
  1254. tab character with "Emulate Tabs" turned on, use Ctrl+Tab.
  1255.  
  1256. It is also possible to tell NEdit not to insert ANY tab characters at all in
  1257. the course of processing emulated tabs, and in shifting and rectangular
  1258. insertion/deletion operations, for programmers who worry about the
  1259. misinterpretation of tab characters on other systems.
  1260.  
  1261.  
  1262. AUTOMATIC INDENT
  1263.  
  1264. Programmers who use structured languages usually require some form of automatic
  1265. indent, so that they don't have to continually re-type the sequences of tabs
  1266. and/or spaces needed to maintain lengthy running indents.  Version 5.0 of NEdit
  1267. is the first release of NEdit to offer "smart" indent, at least experimentally,
  1268. in addition to the traditional automatic indent which simply lines up the
  1269. cursor position with the previous line.
  1270.  
  1271. Smart Indent
  1272.  
  1273. Smart Indent in this release must still be considered somewhat experimental. 
  1274. Smart indent macros are only available by default for C and C++, and while
  1275. these can easily be configured for different default indentation distances,
  1276. they may not conform to everyone's exact C programming style.  Smart indent is
  1277. programmed in terms of macros in the NEdit macro language which can be entered
  1278. in: Preferences -> Default Settings -> Indent -> Program Smart Indent.  Hooks
  1279. are provided for intervening at the point that a newline is entered, either via
  1280. the user pressing the Enter key, or through auto-wrapping; and for arbitrary
  1281. type-in to act on specific characters typed.
  1282.  
  1283. To type a newline character without invoking smart-indent when operating in
  1284. smart-indent mode, hold the Ctrl key while pressing the Return or Enter key.
  1285.  
  1286. Auto-Indent
  1287.  
  1288. With Indent set to Auto (the default), NEdit keeps a running indent.  When you
  1289. press the Return or Enter key, spaces and tabs are inserted to line up the
  1290. insert point under the start of the previous line.  Ctrl+Return in auto-indent
  1291. mode acts like a normal return, With auto-indent turned off, Ctrl+Return does
  1292. indentation.
  1293.  
  1294. Block Indentation Adjustment
  1295.  
  1296. The Shift Left and Shift Right commands as well as rectangular dragging can be
  1297. used to adjust the indentation for several lines at once.  To shift a block of
  1298. text one character to the right, select the text, then choose Shift Right from
  1299. the Edit menu.  Note that the accelerator keys for these menu items are Ctrl+9
  1300. and Ctrl+0, which correspond to  the right and left parenthesis on most
  1301. keyboards.  Remember them as adjusting the text in the direction pointed to by
  1302. the parenthesis character.  Holding the Shift key while selecting either Shift
  1303. Left or Shift Right will shift the text by one tab stop (or by one emulated tab
  1304. stop if tab emulation is turned on).  The help section: "SHIFT LEFT, SHIFT
  1305. RIGHT" above has details.
  1306.  
  1307.  
  1308. SYNTAX HIGHLIGHTING
  1309.  
  1310. Syntax Highlighting means using colors and fonts to help distinguish language
  1311. elements in programming languages and other types of structured files. 
  1312. Programmers use syntax highlighting to understand code faster and better, and
  1313. to spot many kinds of syntax errors more quickly.
  1314.  
  1315. To use syntax highlighting in NEdit, select Highlight Syntax in the Preferences
  1316. menu.  If NEdit recognizes the computer language that you are using, and
  1317. highlighting rules (patterns) are available for that language, it will
  1318. highlight your text, and maintain the highlighting, automatically, as you type.
  1319.  
  1320. If NEdit doesn't correctly recognize the type of the file you are editing, you
  1321. can manually select a language mode from Language Modes in the Preferences
  1322. menu.  You can also program the method that NEdit uses to recognize language
  1323. modes in Preferences -> Default Settings -> Language Modes....
  1324.  
  1325. If no highlighting patterns are available for the language that you want to
  1326. use, you can create new patterns relatively quickly.  The section below titled
  1327. "WRITING SYNTAX HIGHLIGHTING PATTERNS", has details.
  1328.  
  1329. If you are satisfied with what NEdit is highlighting, but would like it to use
  1330. different colors or fonts, you can change these by selecting Preferences ->
  1331. Default Settings -> Syntax Highlighting -> Text Drawing Styles.  Highlighting
  1332. patterns are connected with font and color information through a common set of
  1333. styles so that colorings defined for one language will be similar across
  1334. others, and patterns within the same language which are meant to appear
  1335. identical can be changed in the same place.  To understand which styles are
  1336. used to highlight the language you are interested in, you may need to look at
  1337. "Patterns for Highlighting" section, as well.
  1338.  
  1339. Syntax highlighting is CPU intensive, and under some circumstances can affect
  1340. NEdit's responsiveness.  If you have a particularly slow system, or work with
  1341. very large files, you may not want to use it all of the time.  Syntax
  1342. highlighting introduces two kinds of delays.  The first is an initial parsing
  1343. delay, proportional to the size of the file.  This delay is also incurred when
  1344. pasting large sections of text, filtering text through shell commands, and
  1345. other circumstances involving changes to large amounts of text.  The second
  1346. kind of delay happens when text which has not previously been visible is
  1347. scrolled in to view.  Depending on your system, and the highlight patterns you
  1348. are using, this may or may not be noticeable.  A typing delay is also possible,
  1349. but unlikely if you are only using the built-in patterns.
  1350.  
  1351.  
  1352. FINDING SUBROUTINE AND DATA DECLARATIONS (CTAGS)
  1353.  
  1354. NEdit can process tags files generated using the Unix ctags command or the
  1355. Exuberant Ctags program.  Ctags creates index files correlating names of
  1356. functions and declarations with their locations in C, Fortran, or Pascal source
  1357. code files. (See the ctags manual page for more information).  Ctags produces a
  1358. file called "tags" which can be loaded by NEdit.  NEdit can manage any number
  1359. of tags files simultaneously.  Tag collisions are handled with a popup menu to
  1360. let the user decide which tag to use.  In 'Smart' mode NEdit will automatically
  1361. choose the desired tag based on the scope of the file or module. Once loaded,
  1362. the information in the tags file enables NEdit to go directly to the
  1363. declaration of a highlighted function or data structure name with a single
  1364. command.  To load a tags file, select "Load Tags File" from the File menu and
  1365. choose a tags file to load, or specify the name of the tags file on the NEdit
  1366. command line:
  1367.  
  1368.     nedit -tags tags
  1369.  
  1370. NEdit can also be set to load a tags file automatically when it starts up. 
  1371. Setting the X resource nedit.tagFile to the name of a tag file tells NEdit to
  1372. look for that file at startup time (see Customizing NEdit).  The file name can
  1373. be either a complete path name, in which case NEdit will always load the same
  1374. tags file, or a file name without a path or with a relative path, in which case
  1375. NEdit will load it starting from the current directory.  The second option
  1376. allows you to have different tags files for different projects, each
  1377. automatically loaded depending on the directory you're in when you start
  1378. NEdit.  Setting the name to "tags" is an obvious choice since this is the name
  1379. that ctags uses.
  1380.  
  1381. To unload a tags file, select "Un-load Tags File" from the File menu and choose
  1382. from the list of tags files.  NEdit will keep track of tags file updates by
  1383. checking the timestamp on the files, and automatically update the tags cache. 
  1384.  
  1385. To find the definition of a function or data structure once a tags file is
  1386. loaded, select the name anywhere it appears in your program (see Selecting
  1387. Text) and choose "Find Definition" from the Search menu.
  1388.  
  1389.  
  1390. SHELL COMMANDS AND FILTERS
  1391.  
  1392. The Shell menu (Unix versions only) allows you to execute Unix shell commands
  1393. from within NEdit.  You can add items to the menu to extend NEdit's command set
  1394. or to incorporate custom automatic editing features using shell commands or
  1395. editing languages like awk and sed.  To add items to the menu, select
  1396. Preferences -> Default Settings Customize Menus -> Shell Menu.  NEdit comes
  1397. pre-configured with a few useful Unix commands like spell and sort, but we
  1398. encourage you to add your own custom extensions.
  1399.  
  1400. Filter Selection... prompts you for a Unix command to use to process the
  1401. currently selected text.  The output from this command replaces the contents of
  1402. the selection.
  1403.  
  1404. Execute Command... prompts you for a Unix command and replaces the current
  1405. selection with the output of the command.  If there is no selection, it
  1406. deposits the output at the current insertion point.
  1407.  
  1408. Execute Command Line uses the position of the cursor in the window to indicate
  1409. a line to execute as a shell command line.  The cursor may be positioned
  1410. anywhere on the line.  This command allows you to use an NEdit window as an
  1411. editable command window for saving output and saving commands for re-execution.
  1412.  
  1413. The X resource called nedit.shell (See X RESOURCES) determines which Unix
  1414. shell is used to execute commands.  The default value for this resource is
  1415. /bin/csh.
  1416.  
  1417.  
  1418. LEARN/REPLAY
  1419.  
  1420. Selecting Learn Keystrokes from the Macro menu puts NEdit in learn mode.  In
  1421. learn mode, keystrokes and menu commands are recorded, to be played back later,
  1422. using the Replay Keystrokes command, or pasted into a macro in the Macro
  1423. Commands dialog of the Default Settings menu in Preferences.
  1424.  
  1425. Note that only keyboard and menu commands are recorded, not mouse clicks or
  1426. mouse movements since these have no absolute point of reference, such as cursor
  1427. or selection position.  When you do a mouse-based operation in learn mode,
  1428. NEdit will beep (repeatedly) to remind you that the operation was not recorded.
  1429.  
  1430. Learn mode is also the quickest and easiest method for writing macros.  The
  1431. dialog for creating macro commands contains a button labeled "Paste Learn /
  1432. Replay Macro", which will deposit the last sequence learned into the body of
  1433. the macro.
  1434.  
  1435.  
  1436. REPEATING ACTIONS AND LEARN/REPLAY SEQUENCES
  1437.  
  1438. You can repeat the last (keyboard-based) command, or learn/replay sequence with
  1439. the Repeat... command in the Macro menu.  To repeat an action, first do the
  1440. action (i.e. insert a character, do a search, move the cursor), then select
  1441. Repeat..., decide how or how many times you want it repeated, and click OK. 
  1442. For example, to move down 30 lines through a file, you could type: <Down Arrow>
  1443. Ctrl+, 29 <Return>.  To repeat a learn/replay sequence, first learn it, then
  1444. select Repeat..., click on Learn/Replay and how you want it repeated, then
  1445. click OK.
  1446.  
  1447. If the commands you are repeating advance the cursor through the file, you can
  1448. also repeat them within a range of characters, or from the current cursor
  1449. position to the end of the file.  To iterate over a range of characters, use
  1450. the primary selection (drag the left mouse button over the text) to mark the
  1451. range you want to operate on, and select "In Selection" in the Repeat dialog.
  1452.  
  1453. When using In "Selection" or "To End" with a learned sequence, try to do cursor
  1454. movement as the last step in the sequence, since testing of the cursor position
  1455. is only done at the end of the sequence execution.  If you do cursor movement
  1456. first, for example searching for a particular word then doing a modification,
  1457. the position of the cursor won't be checked until the sequence has potentially
  1458. gone far beyond the end of your desired range.
  1459.  
  1460. It's easy for a repeated command to get out of hand, and you can easily
  1461. generate an infinite loop by using range iteration on a command which doesn't
  1462. progress.  To cancel a repeating command in progress, type Ctrl+. (period), or
  1463. select Cancel Macro from the Macro menu.
  1464.  
  1465.  
  1466. MACRO LANGUAGE
  1467.  
  1468. Macros can be called from Macro menu commands, window background menu commands,
  1469. within the smart-indent framework, and from the .neditmacro file.  Macro menu
  1470. and window background menu commands are defined under Preferences -> Default
  1471. Settings -> Customize Menus.  See the section below titled, "PREFERENCES," for
  1472. more information on creating items in these menus.  The .neditmacro file is a
  1473. file of macro commands and definitions which you can create in your home
  1474. directory, and which NEdit will automatically load when it is first started.
  1475.  
  1476. NEdit's macro language is a simple interpreter with integer arithmetic, dynamic
  1477. strings, and C-style looping constructs (very similar to the procedural portion
  1478. of the Unix awk program).  From the macro language, you can call the same
  1479. action routines which are bound to keyboard keys and menu items, as well
  1480. additional subroutines for accessing and manipulating editor data, which are
  1481. specific to the macro language (these are listed in the sections titled Macro
  1482. Subroutines, and Actions).
  1483.  
  1484. Syntax
  1485.  
  1486. An NEdit macro language program consists of a list of statements, each
  1487. terminated by a newline.  Groups of statements which are executed together
  1488. conditionally, such as the body of a loop, are surrounded by curly braces "{}".
  1489.  
  1490. Blank lines and comments are also allowed.  Comments begin with a "#" and end
  1491. with a newline, and can appear either on a line by themselves, or at the end of
  1492. a statement.
  1493.  
  1494. Statements which are too long to fit on a single line may be split across
  1495. several lines, by placing a backslash "\" character at the end of each line to
  1496. be continued.
  1497.  
  1498. Data Types
  1499.  
  1500. The NEdit macro language recognizes only two data types, dynamic character
  1501. strings, and integer values.  In general strings and integers can be used
  1502. interchangeably.  If a string represents an integer value, it can be used as an
  1503. integer.  Integers can be compared and concatenated with strings.
  1504.  
  1505. Integer Constants:
  1506. Integers are non-fractional numbers in the range of -2147483647 to 2147483647. 
  1507. Integer constants must be in decimal.  For example:
  1508.  
  1509.   a = -1
  1510.   b = 1000
  1511.  
  1512. Character String Constants:
  1513. Character string constants are enclosed in double quotes.  For example:
  1514.  
  1515.    a = "a string"
  1516.    dialog("Hi there!", "Dismiss")
  1517.  
  1518. Strings may also include C-language style escape sequences:
  1519.  
  1520.    \\ Backslash      \t Tab          \f Form feed
  1521.    \" Double quote   \b Backspace      \a Alert
  1522.    \n Newline         \r Carriage return   \v Vertical tab
  1523.  
  1524. For example, to send output to the terminal from which nedit was started, a
  1525. newline character is neccessary because, like printf, t_print requires explicit
  1526. newlines, and also buffers its output on a per-line basis:
  1527.  
  1528.    t_print("a = " a "\n")
  1529.  
  1530. Variables
  1531.  
  1532. Variable names must begin either with a letter (local variables), or a $
  1533. (global variables).  Beyond the first character, variables may also contain
  1534. numbers and underscores `_'.  Variables are called in to existence just by
  1535. setting them (no explicit declarations are necessary).
  1536.  
  1537. Local variables are limited in scope to the subroutine (or menu item
  1538. definition) in which they appear.  Global variables are accessible from all
  1539. routines, and their values persist beyond the call which created them, until
  1540. reset.
  1541.  
  1542. Built-in Variables:
  1543. NEdit has a number of permanently defined variables, which are used to access
  1544. global editor information and information about the the window in which the
  1545. macro is executing.  These are listed along with the built in functions in the
  1546. section titled Macro Subroutines.
  1547.  
  1548. Functions and Subroutines
  1549.  
  1550. The syntax of a function or subroutine call is:
  1551.  
  1552.    function_name(arg1, arg2, ...)
  1553.  
  1554. where arg1, arg2, etc. represent up to 9 argument values which are passed to
  1555. the routine being called.  A function or subroutine call can be on a line by
  1556. itself, as above, or if it returns a value, can be invoked within a character
  1557. or numeric expression:
  1558.  
  1559.    a = fn1(b, c) + fn2(d)
  1560.    dialog("fn3 says: " fn3())
  1561.  
  1562. Arguments are passed by value.  This means that you can not return values via
  1563. the argument list, only through the function value or indirectly through
  1564. agreed-upon global variables.
  1565.  
  1566. Built-in Functions:
  1567. NEdit has a wide range of built in functions which can be called from the macro
  1568. language.  These routines are divided into two classes, macro-language
  1569. functions, and editor action routines.  Editor action routines are more
  1570. flexible, in that they may be called either from the macro language, or bound
  1571. directly to keys via translation tables.  They are also limited, however, in
  1572. that they can not return values.  Macro language routines can return values,
  1573. but can not be bound to keys in translation tables.
  1574.  
  1575. Nearly all of the built-in subroutines operate on an implied window, which is
  1576. initially the window from which the macro was started.  To manipulate the
  1577. contents of other windows, use the focus_window subroutine to change the focus
  1578. to the ones you wish to modify.  focus_window can also be used to iterate over
  1579. all of the currently open windows, using the special keyword names, "last" and
  1580. "next".
  1581.  
  1582. For backwards compatibility, hyphenated action routine names are allowed, and
  1583. most of the existing action routines names which contain underscores have an
  1584. equivalent version containing hyphens ('-') instead of underscores.  Use of
  1585. these names is discouraged.  The macro parser resolves the ambiguity between
  1586. '-' as the subtraction/negation operator, and - as part of an action routine
  1587. name by assuming subtraction unless the symbol specifically matches an action
  1588. routine name.
  1589.  
  1590. User Defined Functions:
  1591. Users can define their own macro subroutines, using the define keyword:
  1592.  
  1593.    define subroutine_name {
  1594.       < body of subroutine >
  1595.    }
  1596.  
  1597. Macro definitions can not appear within other definitions, or within macro menu
  1598. item definitions (usually they are found in the .neditmacro file).
  1599.  
  1600. The arguments with which a user-defined subroutine or function was invoked, are
  1601. presented as $1, $2, ... , $9.  The number of arguments can be read from
  1602. $n_args.
  1603.  
  1604. Operators and Expressions
  1605.  
  1606. Operators have the same meaning and precedence that they do in C, except for ^,
  1607. which raises a number to a power (y^x means y to the x power), rather than
  1608. bitwise exclusive OR.  The table below lists operators in decreasing order of
  1609. precedence.
  1610.  
  1611.    Operators            Associativity
  1612.    ()
  1613.    ^                right to left
  1614.    - ! ++ --            (unary)
  1615.    * / %            left to right
  1616.    + -              left to right
  1617.    > >= < <= == !=        left to right
  1618.    &                left to right
  1619.    |                left to right
  1620.    &&                left to right
  1621.    ||                left to right
  1622.    (concatenation)        left to right
  1623.    = += -= *= /= %=, &= |=  right to left
  1624.  
  1625. The order in which operands are evaluated in an expression is undefined, except
  1626. for && and ||, which like C, evaluate operands left to right, but stop when
  1627. further evaluation would no longer change the result.
  1628.  
  1629. Numerical Operators:
  1630. The numeric operators supported by the NEdit macro language are listed below:
  1631.  
  1632.    + addition
  1633.    - subtraction or negation
  1634.    * multiplication
  1635.    / division
  1636.    % modulo
  1637.    ^ power
  1638.    & bitwise and
  1639.    | bitwise or
  1640.  
  1641. Increment (++) and decrement (--) operators can also be appended or prepended
  1642. to variables within an expression.  Prepended increment/decrement operators act
  1643. before the variable is evaulated.  Appended increment/decrement operators act
  1644. after the variable is evaluated.
  1645.  
  1646. Logical and Comparison Operators:
  1647. Logical operations produce a result of 0 (for false) or 1 (for true).  In a
  1648. logical operation, any non-zero value is recognized to mean true.  The logical
  1649. and comparison operators allowed in the NEdit macro language are listed below:
  1650.  
  1651.    && logical and
  1652.    || logical or
  1653.    !  not
  1654.    >  greater
  1655.    <  less
  1656.    >= greater or equal
  1657.    <= less or equal
  1658.    == equal (integers and/or strings)
  1659.    != not equal (integers and/or strings)
  1660.  
  1661. Character String Operators:
  1662. The "operator" for concatenating two strings is the absence of an operator. 
  1663. Adjoining character strings with no operator in between means concatenation:
  1664.  
  1665.    d = a b "string" c
  1666.    t_print("the value of a is: " a)
  1667.  
  1668. Comparison between character strings is done with the == and != operators, (as
  1669. with integers).  There are a number of useful built-in routines for working
  1670. with character strings, which are listed in the section called Macro
  1671. Subroutines.
  1672.  
  1673. Looping and Conditionals
  1674.  
  1675. NEdit supports looping constructs: for and while, and conditional statements:
  1676. if and else, with essentially the same syntax as C:
  1677.  
  1678.    for (<init>, ...; <condition>; <increment>, ...) <body>
  1679.  
  1680.    while (<condition>) <body>
  1681.  
  1682.    if (<condition>) <body>
  1683.  
  1684.    if (<condition>) <body> else <body>
  1685.  
  1686. <body>, as in C, can be a single statement, or a list of statements enclosed in
  1687. curly braces ({}).  <condition> is an expression which must evaluate to true
  1688. for the statements in <body> to be executed.  for loops may also contain
  1689. initialization statements, <init>, executed once at the beginning of the loop,
  1690. and increment/decrement statements (or any arbitrary statement), which are
  1691. executed at the end of the loop, before the condition is evaluated again.
  1692.  
  1693. Examples:
  1694.  
  1695.   for (i=0; i<100; i++)
  1696.      j = i * 2
  1697.  
  1698.   for (i=0, j=20; i<20; i++, j--) {
  1699.      k = i * j
  1700.      t_print(i, j, k)
  1701.   }
  1702.  
  1703.   while (k > 0)
  1704.   {
  1705.      k = k - 1
  1706.      t_print(k)
  1707.   }
  1708.  
  1709.   for (;;) {
  1710.      if (i-- < 1)
  1711.          break
  1712.   }
  1713.  
  1714. Loops may contain break and continue statements.  A break statement causes an
  1715. exit from the innermost loop, a continue statement transfers control to the end
  1716. of the loop.
  1717.  
  1718.  
  1719. BUILT IN VARIABLES
  1720.  
  1721.    $cursor -- Position of the cursor in the current window.
  1722.  
  1723.    $column -- Column number of the cursor position in the current window.
  1724.  
  1725.    $em_tab_dist -- If tab emulation is turned on in the Tabs... dialog of the
  1726.       Preferences menu, value is the distance between emulated tab stops.  If
  1727.       tab emulation is turned off, value is -1.
  1728.       
  1729.    $file_name -- Name of the file being edited in the current window, stripped
  1730.       of directory component.
  1731.  
  1732.    $file_path -- Directory component of file being edited in the current
  1733.       window.
  1734.  
  1735.    $language_mode -- Name of language mode set in the current window.
  1736.  
  1737.    $line -- Line number of the cursor position in the current window.
  1738.  
  1739.    $modified -- True if the file in the current window has been modified and
  1740.       the modifications have not yet been saved.
  1741.  
  1742.    $selection_start, $selection_end -- Beginning and ending positions of the
  1743.       primary selection in the current window, or -1 if there is no text
  1744.       selected in the current window.
  1745.  
  1746.    $selection_left, $selection_right -- Left and right character offsets of
  1747.       the rectangular (primary) selection in the current window, or -1 if
  1748.       there is no selection or it is not rectangular.
  1749.  
  1750.    $tab_dist -- The distance between tab stops for a hardware tab character,
  1751.       as set in the Tabs... dialog of the Preferences menu.
  1752.  
  1753.    $text_length -- The length of the text in the current window.
  1754.  
  1755.    $use_tabs -- Whether the user is allowing the NEdit to insert tab
  1756.       characters to maintain spacing in tab emulation and rectangular dragging
  1757.       operations. (The setting of the "Use tab characters in padding and
  1758.       emulated tabs" button in the Tabs... dialog of the Preferences menu.)
  1759.  
  1760.    $wrap_margin -- The right margin in the current window for text wrapping
  1761.       and filling.
  1762.  
  1763.  
  1764. BUILT-IN SUBROUTINES
  1765.  
  1766.    append_file(string, filename) -- Appends a string to a named file.  Returns
  1767.       1 on successful write, or 0 if unsuccessful.
  1768.  
  1769.    beep() -- Ring the bell
  1770.  
  1771.    clipboard_to_string() -- Returns the contents of the clipboard as a macro
  1772.       string.  Returns empty string on error.
  1773.  
  1774.    dialog(message, btn_1_label, btn_2_label, ...) -- Pop up a dialog for
  1775.       querying and presenting information to the user.  First argument is a
  1776.       string to show in the message area of the dialog.  Up to nine additional
  1777.       optional arguments represent labels for buttons to appear along the
  1778.       bottom of the dialog.  Returns the number of the button pressed (the
  1779.       first button is number 1), or 0 if the user closed the dialog via the
  1780.       window close box.
  1781.  
  1782.    focus_window(window_name) -- Sets the window on which subsequent macro
  1783.       commands operate.  window_name can be either a fully qualified file name,
  1784.       or one of "last" for the last window created, or "next" for the next
  1785.       window in the chain from the currently focused window (the first window
  1786.       being the one returned from calling focus_window("last").  Returns the
  1787.       name of the newly-focused window, or an empty string if the requested
  1788.       window was not found.
  1789.  
  1790.    get_character(position) -- Returns the single character at the position
  1791.       indicated by the first argument to the routine from the current window.
  1792.  
  1793.    get_range(start, end) -- Returns the text between a starting and ending
  1794.       position from the current window.
  1795.  
  1796.    get_selection() -- Returns a string containing the text currently selected
  1797.       by the primary selection either from the current window (no keyword), or
  1798.       from anywhere on the screen (keyword "any").
  1799.  
  1800.    getenv(name) -- Gets the value of an environment variable.
  1801.  
  1802.    length(string) -- Returns the length of a string
  1803.  
  1804.    list_dialog(message, text, btn_1_label, btn_2_label, ...) -- Pop up a dialog
  1805.       for prompting the user to choose a line from the given text string.  The
  1806.       first argument is a message string to be used as a title for the fixed
  1807.       text describing the list.  The second string provides the list data: this
  1808.       is a text string in which list entries are separated by newline
  1809.       characters.  Up to seven additional optional arguments represent labels
  1810.       for buttons to appear along the bottom of the dialog.  Returns the line
  1811.       of text selected by the user as the function value (without any newline
  1812.       separator) or the empty string if none was selected, and number of the
  1813.       button pressed (the first button is number 1), in $list_dialog_button. 
  1814.       If the user closes the dialog via the window close box, the function
  1815.       returns the empty string, and $list_dialog_button returns 0.
  1816.  
  1817.    max(n1, n2, ...) -- Returns the maximum value of all of its arguments
  1818.  
  1819.    min(n1, n2, ...) -- Returns the minimum value of all of its arguments
  1820.  
  1821.    read_file(filename) -- Reads the contents of a text file into a string.  On
  1822.       success, returns 1 in $read_status, and the contents of the file as a
  1823.       string in the subroutine return value.  On failure, returns the empty
  1824.       string "" and an 0 $read_status.
  1825.  
  1826.    replace_in_string(string, search_for, replace_with, [type]) -- Replaces all
  1827.       occurrences of a search string in a string with a replacement string. 
  1828.       Arguments are 1: string to search in, 2: string to search for, 3:
  1829.       replacement string.  Argument 4 is an optional search type, one of
  1830.       "literal", "case" or "regex".  The default search type is "literal". 
  1831.       Returns a new string with all of the replacements done, or an empty
  1832.       string ("") if no occurrences were found.
  1833.  
  1834.    replace_range(start, end, string) -- Replaces all of the text in the current
  1835.       window between two positions.
  1836.  
  1837.    replace_selection(string) -- Replaces the primary-selection selected text in
  1838.       the current window.
  1839.  
  1840.    replace_substring(string, start, end, replace_with) -- Replacing a substring
  1841.       between two positions in a string within another string.
  1842.  
  1843.    search(search_for, start, [search_type, wrap, direction]) -- Searches
  1844.       silently in a window without dialogs, beeps, or changes to the
  1845.       selection.  Arguments are: 1: string to search for, 2: starting position.
  1846.       Optional arguments may include the strings: "wrap" to make the search
  1847.       wrap around the beginning or end of the string, "backward" or "forward"
  1848.       to change the search direction ("forward" is the default), "literal",
  1849.       "case" or "regex" to change the search type (default is "literal").
  1850.       Returns the starting position of the match, or -1 if nothing matched.
  1851.       also returns the ending position of the match in search_end
  1852.  
  1853.    search_string(string, search_for, start, [search_type, direction]) --
  1854.       Built-in macro subroutine for searching a string.  Arguments are 1:
  1855.       string to search in, 2: string to search for, 3: starting position.
  1856.       Optional arguments may include the strings: "wrap" to make the search
  1857.       wrap around the beginning or end of the string, "backward" or "forward"
  1858.       to change the search direction ("forward" is the default), "literal",
  1859.       "case" or "regex" to change the search type (default is "literal").
  1860.       Returns the starting position of the match, or -1 if nothing matched.
  1861.       Also returns the ending position of the match in $search_end
  1862.  
  1863.    select(start, end) -- Selects (with the primary selection) text in the
  1864.       current buffer between a starting and ending position.
  1865.  
  1866.    select_rectangle(start, end, left, right) -- Selects a rectangular area of
  1867.       text between a starting and ending position, and confined horizontally to
  1868.       characters displayed between positions "left", and "right".
  1869.  
  1870.    set_cursor_pos(pos) -- Set the cursor position for the current window.
  1871.  
  1872.    set_language_mode(mode) -- Change language mode for the current window.
  1873.  
  1874.    shell_command(command, input_string) -- executes a shell command, feeding it
  1875.       input from input_string.  On completion, output from the command is
  1876.       returned as the function value, and the command's exit status is returned
  1877.       in the global variable $shell_cmd_status.
  1878.  
  1879.    string_dialog(message, btn_1_label, btn_2_label, ...) -- Pop up a dialog for
  1880.       prompting the user to enter information.  The first argument is a string
  1881.       to show in the message area of the dialog.  Up to nine additional
  1882.       optional arguments represent labels for buttons to appear along the
  1883.       bottom of the dialog.  Returns the string entered by the user as the
  1884.       function value, and number of the button pressed (the first button is
  1885.       number 1), in $string_dialog_button.  If the user closes the dialog via
  1886.       the window close box, the function returns the empty string, and
  1887.       $string_dialog_button returns 0.
  1888.  
  1889.    string_to_clipboard(string) -- Copy the contents of a macro string to the
  1890.       clipboard.
  1891.  
  1892.    substring(string, start, end) -- Returns the portion of a string between a
  1893.       starting and ending position.
  1894.  
  1895.    t_print(string1, string2, ...) -- Writes strings to the terminal (stdout)
  1896.       from which NEdit was started.
  1897.  
  1898.    tolower(string) -- Return an all lower-case version of string.
  1899.  
  1900.    toupper(string) -- Return an all upper-case version of string.
  1901.  
  1902.    write_file(string, filename) -- Writes a string (parameter 1) to a file
  1903.       named in parameter 2.  Returns 1 on successful write, or 0 if
  1904.       unsuccessful.
  1905.  
  1906.  
  1907. ACTION ROUTINES
  1908.  
  1909. All of the editing capabilities of NEdit are represented as a special type of
  1910. subroutine, called an action routine, which can be invoked from both macros and
  1911. translation table entries (see KEY BINDING below).
  1912.  
  1913.  
  1914. Actions Representing Menu Commands:
  1915.  
  1916.     File Menu              Search Menu
  1917.     ---------------------     -----------------------
  1918.     new()              find()
  1919.     open()              find_dialog()
  1920.     open_dialog()          find_again()
  1921.     open_selected()          find_selection()
  1922.     close()              replace()
  1923.     save()              replace_dialog()
  1924.     save_as()              replace_all()
  1925.     save_as_dialog()          replace_in_selection()
  1926.     revert_to_saved()          replace_again()
  1927.     include_file()          goto_line_number()
  1928.     include_file_dialog ()    goto_line_number_dialog()
  1929.     load_tags_file()          goto_selected()
  1930.     load_tags_file_dialog()   mark()
  1931.     load_macro_file()         mark_dialog()
  1932.     load_macro_file_dialog()  goto_mark()
  1933.     print()              goto_mark_dialog()
  1934.     print_selection()          match()
  1935.     unload_tags_file()        find_definition()
  1936.     exit()              split_window()
  1937.                       close_pane()
  1938.     Edit Menu              
  1939.     ---------------------     Shell Menu
  1940.     undo()              -----------------------
  1941.     redo()              filter_selection_dialog()
  1942.     delete()              filter_selection()
  1943.     select_all()          execute_command()
  1944.     shift_left()          execute_command_dialog()
  1945.     shift_left_by_tab()       execute_command_line()
  1946.     shift_right()          shell_menu_command()
  1947.     shift_right_by_tab()      
  1948.     uppercase()           Macro Menu
  1949.     lowercase()           -----------------------
  1950.     fill_paragraph()          macro_menu_command()
  1951.     control_code_dialog()     repeat_macro()
  1952.                       repeat_dialog()
  1953.  
  1954. The actions representing menu commands are named the same as the menu item with
  1955. punctuation removed, all lower case, and underscores replacing spaces.  Without
  1956. the _dialog suffix, commands which normally prompt the user for information,
  1957. instead take the information from the routine's arguments (see below).  To
  1958. present a dialog and ask the user for input, rather than supplying it in via
  1959. arguments, use the actions with the _dialog suffix.
  1960.  
  1961. Menu Action Routine Arguments:
  1962.  
  1963. Arguments are text strings enclosed in quotes.  Below are the menu action
  1964. routines which take arguments.  Optional arguments are inclosed in [].
  1965.  
  1966.   open(filename)
  1967.  
  1968.   save_as(filename)
  1969.  
  1970.   include(filename)
  1971.  
  1972.   load_tags_file(filename)
  1973.  
  1974.   find_dialog([search_direction])
  1975.  
  1976.   find(search_string [, search-direction], [search-type])
  1977.  
  1978.   find_again([search-direction])
  1979.  
  1980.   find_selection([search-direction])
  1981.  
  1982.   replace_dialog([search-direction])
  1983.  
  1984.   replace(search-string, replace-string,
  1985.       [, search-direction] [, search-type])
  1986.  
  1987.   replace_in_selection(search-string, replace-string
  1988.       [, search-type])
  1989.  
  1990.   replace_again([search-direction])
  1991.  
  1992.   goto_line_number([line-number])
  1993.  
  1994.   mark(mark-letter)
  1995.  
  1996.   goto_mark(mark-letter)
  1997.  
  1998.   filter_selection(shell-command)
  1999.  
  2000.   execute_command(shell-command)
  2001.  
  2002.   shell_menu_command(shell-menu-item-name)
  2003.  
  2004.   macro_menu_command(macro-menu-item-name)
  2005.  
  2006. Some notes on argument types above:
  2007.  
  2008.   filename        Path names are interpreted relative
  2009.              to the directory from which NEdit was
  2010.              started, wildcards and ~ are not
  2011.              expanded.
  2012.              
  2013.   search-direction  Either "forward" or "backward"
  2014.  
  2015.   search-type        Either "literal", "case", or "regex"
  2016.  
  2017.   mark-letter        The mark command limits users to
  2018.              single letters.  Inside of macros,
  2019.              numeric marks are allowed, which won't
  2020.              interfere with marks set by the user.
  2021.  
  2022.   (macro or shell)  Name of the command exactly as
  2023.   -menu-item-name   specified in the Shell Menu or
  2024.              Macro Menu dialogs
  2025.  
  2026.  
  2027. Keyboard-Only Actions
  2028.  
  2029.    backward_character() -- Moves the cursor one character to the left.
  2030.  
  2031.    backward_paragraph() -- Moves the cursor to the beginning of the paragraph,
  2032.       or if the cursor is already at the beginning of a paragraph, moves the
  2033.       cursor to the beginning of the previous paragraph.  Paragraphs are
  2034.       defined as regions of text delimited by one or more blank lines.
  2035.  
  2036.    backward_word() -- Moves the cursor to the beginning of a word, or, if the
  2037.       cursor is already at the beginning of a word, moves the cursor to the
  2038.       beginning of the previous word.  Word delimiters are user-settable, and
  2039.       defined by the X resource wordDelimiters.
  2040.  
  2041.    beginning_of_file() -- Moves the cursor to the beginning of the file.
  2042.  
  2043.    beginning_of_line() -- Moves the cursor to the beginning of the line.
  2044.  
  2045.    beginning_of_selection() -- Moves the cursor to the beginning of the
  2046.       selection without disturbing the selection.
  2047.  
  2048.    copy_clipboard() -- Copies the current selection to the clipboard.
  2049.  
  2050.    copy_primary() -- Copies the primary selection to the cursor.
  2051.  
  2052.    copy_to() -- If a secondary selection exists, copies the secondary selection
  2053.       to the cursor.  If no secondary selection exists, copies the primary
  2054.       selection to the pointer location.
  2055.  
  2056.    copy_to_or_end_drag() -- Completes either a secondary selection operation,
  2057.       or a primary drag.  If the user is dragging the mouse to adjust a
  2058.       secondary selection, the selection is copied and either inserted at the
  2059.       cursor location, or, if pending-delete is on and a primary selection
  2060.       exists in the window, replaces the primary selection.  If the user is
  2061.       dragging a block of text (primary selection), completes the drag
  2062.       operation and leaves the text at it's current location.
  2063.  
  2064.    cut_clipboard() -- Deletes the text in the primary selection and places it
  2065.       in the clipboard.
  2066.  
  2067.    cut_primary() -- Copies the primary selection to the cursor and deletes it
  2068.       at its original location.
  2069.  
  2070.    delete_selection() -- Deletes the contents of the primary selection.
  2071.  
  2072.    delete_next_character() -- If a primary selection exists, deletes its
  2073.       contents. Otherwise, deletes the character following the cursor.
  2074.  
  2075.    delete_previous_character() -- If a primary selection exists, deletes its
  2076.       contents.  Otherwise, deletes the character before the cursor.
  2077.  
  2078.    delete_next_word() -- If a primary selection exists, deletes its contents.
  2079.       Otherwise, deletes the word following the cursor.
  2080.  
  2081.    delete_previous_word() -- If a primary selection exists, deletes its
  2082.       contents. Otherwise, deletes the word before the cursor.
  2083.  
  2084.    delete_to_start_of_line() -- If a primary selection exists, deletes its
  2085.       contents. Otherwise, deletes the characters between the cursor and the
  2086.       start of the line.
  2087.  
  2088.    delete_to_end_of_line() -- If a primary selection exists, deletes its
  2089.       contents. Otherwise, deletes the characters between the cursor and the
  2090.       end of the line.
  2091.  
  2092.    deselect_all() -- De-selects the primary selection.
  2093.  
  2094.    end_of_file() -- Moves the cursor to the end of the file.
  2095.  
  2096.    end_of_line() -- Moves the cursor to the end of the line.
  2097.  
  2098.    end_of_selection() -- Moves the cursor to the end of the selection without
  2099.       disturbing the selection.
  2100.  
  2101.    exchange() -- Exchange the primary and secondary selections.
  2102.  
  2103.    extend_adjust() -- Attached mouse-movement events to begin a selection
  2104.       between the cursor and the mouse, or extend the primary selection to the
  2105.       mouse position.
  2106.  
  2107.    extend_end() -- Completes a primary drag-selection operation.
  2108.  
  2109.    extend_start() -- Begins a selection between the cursor and the mouse.  A
  2110.       drag-selection operation can be started with either extend_start or
  2111.       grab_focus.
  2112.  
  2113.    forward_character() -- Moves the cursor one character to the right.
  2114.  
  2115.    forward_paragraph() -- Moves the cursor to the beginning of the next
  2116.       paragraph. Paragraphs are defined as regions of text delimited by one or
  2117.       more blank lines.
  2118.  
  2119.    forward_word() -- Moves the cursor to the beginning of the next word.  Word
  2120.       delimiters are user-settable, and defined by the X resource
  2121.       wordDelimiters.
  2122.  
  2123.    grab_focus() -- Moves the cursor to the mouse pointer location, and prepares
  2124.       for a possible drag-selection operation (bound to extend_adjust), or
  2125.       multi-click operation (a further grab_focus action).  If a second
  2126.       invocation of grab focus follows immediately, it selects a whole word, or
  2127.       a third, a whole line.
  2128.  
  2129.    insert_string("string")  If pending delete is on and the cursor is inside
  2130.       the selection, replaces the selection with "string".  Otherwise, inserts
  2131.       "string" at the cursor location.
  2132.  
  2133.    key_select("direction") Moves the cursor one character in "direction"
  2134.       ("left", "right", "up", or "down") and extends the selection.  Same as
  2135.       forward/backward-character("extend"), or process-up/down("extend"), for
  2136.       compatibility with previous versions.
  2137.  
  2138.    move-destination() -- Moves the cursor to the pointer location without
  2139.       disturbing the selection.  (This is an unusual way of working.  We left
  2140.       it in for compatibility with previous versions, but if you actually use
  2141.       this capability, please send us some mail, otherwise it is likely to
  2142.       disappear in the future.
  2143.  
  2144.    move_to() -- If a secondary selection exists, deletes the contents of the
  2145.       secondary selection and inserts it at the cursor, or if pending-delete is
  2146.       on and there is a primary selection, replaces the primary selection.  If
  2147.       no secondary selection exists, moves the primary selection to the pointer
  2148.       location, deleting it from its original position.
  2149.  
  2150.    move_to_or_end_drag() -- Completes either a secondary selection operation,
  2151.       or a primary drag.  If the user is dragging the mouse to adjust a
  2152.       secondary selection, the selection is deleted and either inserted at the
  2153.       cursor location, or, if pending-delete is on and a primary selection
  2154.       exists in the window, replaces the primary selection.  If the user is
  2155.       dragging a block of text (primary selection), completes the drag
  2156.       operation and deletes the text from it's current location.
  2157.  
  2158.    newline() -- Inserts a newline character.  If Auto Indent is on, lines up
  2159.       the indentation of the cursor with the current line.
  2160.  
  2161.    newline_and_indent() -- Inserts a newline character and lines up the
  2162.       indentation of the cursor with the current line, regardless of the
  2163.       setting of Auto Indent.
  2164.  
  2165.    newline_no_indent() -- Inserts a newline character, without automatic
  2166.       indentation, regardless of the setting of Auto Indent.
  2167.  
  2168.    next_page() -- Moves the cursor and scroll forward one page.
  2169.  
  2170.    page_left() -- Move the cursor and scroll left one page.
  2171.  
  2172.    page_right() -- Move the cursor and scroll right one page.
  2173.  
  2174.    paste_clipboard() -- Insert the contents of the clipboard at the cursor, or
  2175.       if pending delete is on, replace the primary selection with the contents
  2176.       of the clipboard.
  2177.  
  2178.    previous_page() -- Moves the cursor and scroll backward one page.
  2179.  
  2180.    process_bdrag() -- Same as secondary_or_drag_start for compatibility with
  2181.       previous versions.
  2182.  
  2183.    process_cancel() -- Cancels the current extend_adjust, secondary_adjust, or
  2184.       secondary_or_drag_adjust in progress.
  2185.  
  2186.    process_down() -- Moves the cursor down one line.
  2187.  
  2188.    process_return() -- Same as newline for compatibility with previous
  2189.       versions.
  2190.  
  2191.    process_shift_down() -- Same as process_down("extend") for compatibility
  2192.       with previous versions.
  2193.  
  2194.    process_shift_up() -- Same as process_up("extend") for compatibility with
  2195.       previous versions.
  2196.  
  2197.    process_tab() -- If tab emulation is turned on, inserts an emulated tab,
  2198.       otherwise inserts a tab character.
  2199.  
  2200.    process_up() -- Moves the cursor up one line.
  2201.  
  2202.    scroll_down(nLines) Scroll the display down (towards the end of the file) by
  2203.       nLines.
  2204.  
  2205.    scroll_up(nLines) Scroll the display up (towards the beginning of the file)
  2206.       by nLines.
  2207.  
  2208.    scroll_to_line(lineNum) Scroll to position line number lineNum at the top of
  2209.       the pane.  The first line of a file is line 1.
  2210.  
  2211.    secondary_adjust() -- Attached mouse-movement events to extend the secondary
  2212.       selection to the mouse position.
  2213.  
  2214.    secondary_or_drag_adjust() -- Attached mouse-movement events to extend the
  2215.       secondary selection, or reposition the primary text being dragged.  Takes
  2216.       two optional arguments, "copy", and "overlay".  "copy" leaves a copy of
  2217.       the dragged text at the site at which the drag began.  "overlay" does the
  2218.       drag in overlay mode, meaning the dragged text is laid on top of the
  2219.       existing text, obscuring and ultimately deleting it when the drag is
  2220.       complete.
  2221.  
  2222.    secondary_or_drag_start() -- To be attached to a mouse down event.  Begins
  2223.       drag selecting a secondary selection, or dragging the contents of the
  2224.       primary selection, depending on whether the mouse is pressed inside of an
  2225.       existing primary selection.
  2226.  
  2227.    secondary_start() -- To be attached to a mouse down event.  Begin drag
  2228.       selecting a secondary selection.
  2229.  
  2230.    select_all() -- Select the entire file.
  2231.  
  2232.    self_insert() -- To be attached to a key-press event, inserts the character
  2233.       equivalent of the key pressed.
  2234.       
  2235. Arguments to Keyboard Action Routines 
  2236.  
  2237. In addition to the arguments listed in the call descriptions, any routine
  2238. involving cursor movement can take the argument "extend", meaning, adjust the
  2239. primary selection to the new cursor position.  Routines which take the "extend"
  2240. argument as well as mouse dragging operations for both primary and secondary
  2241. selections can take the optional keyword "rect", meaning, make the selection
  2242. rectangular.
  2243.     
  2244.  
  2245. CUSTOMIZATION
  2246.  
  2247. NEdit can be customized many different ways.  The most important user-settable
  2248. options are presented in the Preferences menu, including all options that users
  2249. might need to change during an editing session.  Options set in the Default
  2250. Settings sub-menu of the Preferences menu can be preserved between sessions by
  2251. selecting Save Defaults, which writes a file called .nedit in the user's home
  2252. directory.  See the section titled PREFERENCES for more details.
  2253.  
  2254. User defined commands can be added to NEdit's Shell, Macro, and window
  2255. background menus.  Dialogs for creating items in these menus can be found under
  2256. Customize Menus in the Default Settings sub menu of the Preferences menu.
  2257.  
  2258. For users who depend on NEdit every day and want to tune every excruciating
  2259. detail, there are also X resources for tuning a vast number of such details,
  2260. down to the color of each individual button.  See the section "X Resources" for
  2261. more information, as well as a list of selected resources.
  2262.  
  2263. The most common reason customizing your X resources for NEdit, however, is key
  2264. binding.  While limited key binding can be done through Preferences settings
  2265. (Preferences -> Default Settings -> Customize Menus), you can really only add
  2266. keys this way, and each key must have a corresponding menu item.  Any
  2267. significant changes to key binding should be made via the Translations resource
  2268. and menu accelerator resources.  The sections titled "Key Binding" and "X
  2269. Resources" have more information.
  2270.  
  2271.  
  2272. PREFERENCES
  2273.  
  2274. The Preferences menu allows you to set options for both the current editing
  2275. window, and default values for newly created windows and future NEdit
  2276. sessions.  Options in the Preferences menu itself (not in the Default Settings
  2277. sub-menu) take effect immediately and refer to the current window only. 
  2278. Options in the Default Settings sub-menu have no effect on the current window,
  2279. but instead provide initial settings for future windows created using the New
  2280. or Open commands.  Preferences set in the Default Settings sub-menu can also be
  2281. saved in a file that is automatically read by NEdit at startup time, by
  2282. selecting Save Defaults.
  2283.  
  2284. Preferences Menu
  2285.  
  2286.    Default Settings -- Menu of initial settings for future windows.
  2287.       Generally the same as the options in the main part of the menu, but
  2288.       apply as defaults for future windows created during this NEdit
  2289.       session.  These settings can be saved using the Save Defaults command
  2290.       below, to be loaded automatically each time NEdit is started.
  2291.  
  2292.    Save Defaults -- Save the default options as set under Default Settings
  2293.       for future NEdit sessions.
  2294.  
  2295.    Statistics Line -- Show the full file name, line number, and length of the
  2296.       file being edited.
  2297.  
  2298.    Incremental Search Line -- Keep the incremental search bar (Search ->
  2299.       Find Incremental) permanently displayed at the top of the window.
  2300.  
  2301.    Show Line Numbers -- Display line numbers to the right of the text.
  2302.  
  2303.    Language Mode -- Tells NEdit what language (if any) to assume, for
  2304.       selecting language-specific features such as highlight patterns and
  2305.       smart indent macros, and setting language specific preferences like
  2306.       word delimiters, tab emulation, and auto-indent.  See FEATURES FOR
  2307.       PROGRAMMING for more information.
  2308.  
  2309.    Auto Indent -- Setting Auto Indent "on" maintains a running indent
  2310.       (pressing the return key will line up the cursor with the indent level
  2311.       of the previous line).  If smart indent macros are available for the
  2312.       current language mode, smart indent can be selected and NEdit will
  2313.       attempt to guess proper language indentation for each new line.  See
  2314.       AUTOMATIC INDENT for more information.
  2315.  
  2316.    Wrap -- Choose between two styles of automatic wrapping or none.  Auto
  2317.       Newline wrap, wraps text at word boundaries when the cursor reaches the
  2318.       right margin, by replacing the space or tab at the last word boundary
  2319.       with a newline character.  Continuous Wrap wraps long lines which
  2320.       extend past the right margin. Continuous Wrap mode is typically used to
  2321.       produce files where newlines are ommitted within paragraphs, to make
  2322.       text filling automatic (a kind of poor-man's word processor).  Text of
  2323.       this style is common on Macs and PCs but is not necessarily supported
  2324.       very well under Unix (except in programs which deal with e-mail, for
  2325.       which it is often the format of choice).
  2326.  
  2327.       Wrap Margin -- Set margin for Auto Newline Wrap, Continuous Wrap, and
  2328.      Fill Paragraph.  Lines may, be wrapped at the right margin of the
  2329.      window, or the margin can be set at a specific column.
  2330.  
  2331.    Tabs -- Set the tab distance (number of characters between tab stops) for
  2332.       tab characters, and control tab emulation and use of tab characters in
  2333.       padding and emulated tabs.
  2334.  
  2335.    Text Font... -- Change the font(s) used to display text (fonts for menus
  2336.       and dialogs must be set using X resources for the text area of the
  2337.       window). See below for more information.
  2338.  
  2339.    Highlight Syntax -- If NEdit recognizes the language being edited, and
  2340.       highlighting patterns are available for that language, use fonts and
  2341.       colors to enhance viewing of the file.  See "SYNTAX HIGHLIGHTING" for
  2342.       more information.
  2343.  
  2344.    Make Backup Copy -- On Save, write a backup copy of the file as it existed
  2345.       before the Save command with the extension .bck (Unix only).
  2346.  
  2347.    Incremental Backup -- Periodically make a backup copy of the file being
  2348.       edited under the name ~filename on Unix or _filename on VMS (see CRASH
  2349.       RECOVERY).
  2350.  
  2351.    Show Matching (..) -- Momentarily highlight matching parenthesis,
  2352.       brackets, and braces when one of these characters is typed, or when the
  2353.       insertion cursor is positioned after it.
  2354.  
  2355.    Overtype -- In overtype mode, new characters entered replace the
  2356.       characters in front of the insertion cursor, rather than being inserted
  2357.       before them.
  2358.  
  2359.    Read Only -- Lock the file against accidental modification.  This
  2360.       temporarily prevents the file from being modified in this NEdit
  2361.       session. Note that this is diferent from setting the file protection.
  2362.  
  2363. Preferences -> Default Settings Menu
  2364.  
  2365. Options in the Preferences -> Default Settings menu have the same meaning as
  2366. those in the top-level Preferences menu, except that they apply to future NEdit
  2367. windows and future NEdit sessions if saved with the Save Defaults command. 
  2368. Additional options which appear in this menu are:
  2369.  
  2370.    Language Modes -- Define language recognition information (for
  2371.       determining language mode from file name or content) and set language
  2372.       specific preferences.
  2373.  
  2374.    Tag Collisions -- How to react to multiple tags for the same name.  Tags
  2375.       are described in the section: Features for Programmers -> Finding
  2376.       Declarations (ctags).  In Show All mode, all matching tags are displayed
  2377.       in a dialog.  In Smart mode, if one of the matching tags is in the
  2378.       current window, that tag is chosen, without displaying the dialog.
  2379.  
  2380.    Customize Menus -- Add/remove items from the Shell, Macro, and window
  2381.       background menus (see below).
  2382.  
  2383.    Searching -- Options for controlling the behavior of Find and Replace
  2384.       commands:
  2385.  
  2386.         Verbose - Presents search results in dialog form, asks before
  2387.            wrapping a search back around the beginning (or end) of the
  2388.            file.
  2389.  
  2390.         Keep Dialogs Up - Don't pop down Replace and Find boxes after
  2391.            searching.
  2392.  
  2393.         Default Search Style - Initial setting for search type in Find and
  2394.            Replace dialogs.
  2395.  
  2396.    Syntax Highlighting -- Program and configure enhanced text display for
  2397.       new or supported languages (See SYNTAX HIGHLIGHTING and WRITING SYNTAX
  2398.       HIGHLIGHTING PATTERNS).
  2399.  
  2400.    Sort Open Prev. Menu -- Option to order the File -> Open Previous menu
  2401.       alphabetically, versus in order of last access.
  2402.  
  2403.    Popups Under Pointer -- Display pop-up dialogs centered on the current
  2404.       mouse position, as opposed to centered on the parent window.  This
  2405.       generally speeds interaction, and is essential for users who users who
  2406.       set their window managers so keyboard focus follows the mouse.
  2407.  
  2408.    Modification Warnings -- Pop up a warning dialog when files get changed
  2409.       external to nedit.  Checking is done both before a save which might
  2410.       overwrite a modified file, and when changes are made to nedit's
  2411.       displayed version of the file.
  2412.  
  2413.    Initial Window Size -- Default size for new windows.
  2414.  
  2415. Changing Font(s)
  2416.  
  2417. The font used to display text in NEdit is set under Preferences -> Text Font
  2418. (for the current window), or Preferences -> Default Settings Text Font (for
  2419. future windows).  These dialogs also allow you to set fonts for syntax
  2420. highlighting.  If you don't intend to use syntax highlighting, you can ignore
  2421. most of the dialog, and just set the field labeled Primary Font.
  2422.  
  2423. Unless you are absolutely certain about the types of files that you will be
  2424. editing with NEdit, you should choose a fixed-spacing font.  Many, if not most,
  2425. plain-text files are written expecting to be viewed with fixed character
  2426. spacing, and will look wrong with proportional spacing.  NEdit's filling,
  2427. wrapping, and rectangular operations will also work strangely if you choose a
  2428. proportional font.
  2429.  
  2430. Note that in the font browser (the dialog brought up by the Browse... button),
  2431. the subset of fonts which are shown is narrowed depending on the
  2432. characteristics already selected.  It is therefore important to know that you
  2433. can unselect characteristics from the lists by clicking on the selected items a
  2434. second time.
  2435.  
  2436. Fonts for syntax highlighting should ideally match the primary font in both
  2437. height and spacing.  A mismatch in spacing will result in similar distortions
  2438. as choosing a proportional font: column alignment will sometimes look wrong,
  2439. and rectangular operations, wrapping, and filling will behave strangely.  A
  2440. mismatch in height will cause windows to re-size themselves slightly when
  2441. syntax highlighting is turned on or off, and increase the inter- line spacing
  2442. of the text.  Unfortunately, on some systems it is hard to find sets of fonts
  2443. which match exactly in height.
  2444.  
  2445. Customizing Menus
  2446.  
  2447. You can add or change items in the Shell, Macro, and window background menus
  2448. under Preferences -> Default Settings -> Customize Menus.  When you choose one
  2449. of these, you will see a dialog with a list of the current user-configurable
  2450. items from the menu on the left.  To change an existing item, select it from
  2451. the list, and its properties will appear in the remaining fields of the dialog,
  2452. where you may change them.  Selecting the item "New" from the list allows you
  2453. to enter new items in the menu.
  2454.  
  2455. Hopefully most of the characteristics are self explanatory, but here are a few
  2456. things to note:
  2457.  
  2458. Accelerator keys are keyboard shortcuts which appear on the right hand side of
  2459. the menus, and allow you avoid pulling down the menu and activate the command
  2460. with a single keystroke.  Enter accelerators by typing the keys exactly as you
  2461. would to activate the command.
  2462.  
  2463. Mnemonics are a single letter which should be part of the menu item name, which
  2464. allow users to traverse and activate menu items by typing keys when the menu is
  2465. pulled down.
  2466.  
  2467. In the Shell Command field of the Shell Commands dialog, the % character
  2468. expands to the name (including directory path) of the file in the window.  To
  2469. include a % character in the command, use %%.
  2470.  
  2471. The Menu Entry field can contain special characters for constructing
  2472. hierarchical sub-menus, and for making items which appear only in certain
  2473. language modes.  The right angle bracket character ">" creates a sub-menu.  The
  2474. name of the item itself should be the last element of the path formed from
  2475. successive sub-menu names joined with ">".  Menu panes are called in to
  2476. existence simply by naming them as part of a Menu Entry name.  To put several
  2477. items in the same sub-menu, repeat the same hierarchical sequence for each. 
  2478. For example, in the Macro Commands dialog, two items with menu entries: a>b>c
  2479. and a>b>d would create a single sub menu under the macro menu called "a", which
  2480. would contain a single sub-menu, b, holding the actual items, c and d:
  2481.  
  2482.     +---++---++---+
  2483.     |a >||b >||c  |
  2484.     +---++---+|d  |
  2485.               +---+
  2486.  
  2487. To qualify a menu entry with a language mode, simply add an at-sign "@" at the
  2488. end of the menu command, followed (no space) by a language mode name.  To make
  2489. a menu item which appears in several language modes, append additional @s and
  2490. language mode names.  For example, an item with the menu entry:
  2491.  
  2492.   Make C Prototypes@C@C++
  2493.  
  2494. would appear only in C and C++ language modes, and:
  2495.  
  2496.   Make Class Template@C++
  2497.  
  2498. would appear only in C++ mode.  Menu items with no qualification appear in all
  2499. language modes.
  2500.  
  2501. If a menu item is followed by the single language qualification "@*", that item
  2502. will appear only if there are no applicable language-specific items of the same
  2503. name in the same submenu.  For example, if you have the following three entries
  2504. in the same menu:
  2505.  
  2506.   Make Prototypes@C@C++
  2507.   Make Prototypes@Java
  2508.   Make Prototypes@*
  2509.  
  2510. The first will be available when the language mode is C or C++, the second when
  2511. the language mode is Java, and for all other language modes (including the
  2512. "Plain" non-language mode).  If the entry:
  2513.  
  2514.   Make Prototypes
  2515.  
  2516. also exists, this will always appear, meaning that the menu will always have
  2517. two "Make Prototypes" entries, whatever the language mode.
  2518.  
  2519. Sharing Customizations with Other NEdit Users
  2520.  
  2521. If you have written macro or shell menu commands, highlight patterns, or smart-
  2522. indent macros that you want to share with other NEdit users, you can make a
  2523. file which they can load into their nedit environment.
  2524.  
  2525. To load such a file, start nedit with the command:
  2526.  
  2527.    nedit -import <file>
  2528.  
  2529. In the new nedit session, verify that the imported patterns or macros do what
  2530. you want, then select Preferences -> Save Defaults.  Saving incorporates the
  2531. changes into your own .nedit file, so the next time you run nedit, you will not
  2532. have to import the distribution file.
  2533.  
  2534. Loading a customization file is automated, but creating one is not.  To produce
  2535. a file to be imported by other users, you must make a copy of your own .nedit
  2536. file, and edit it, by hand, to remove everything but the few items of interest
  2537. to the recipient.  Leave only the individual resource(s), and within those
  2538. resources, only the particular macro, pattern, style, etc, that you wish to
  2539. exchange.  For example, to share a highlighting pattern set, you would include
  2540. the patterns, any new styles you added, and language mode information only if
  2541. the patterns are intended to support a new language rather than updating an
  2542. existing one. For example:
  2543.  
  2544.    nedit.highlightPatterns:\
  2545.     My Language:1:0{\n\
  2546.         Comment:"#":"$"::Comment::\n\
  2547.         Loop Header:"^[ \\t]*loop:":::Loop::\n\
  2548.     }
  2549.    nedit.languageModes: My Language:.my::::::
  2550.    nedit.styles: Loop:blue:Bold
  2551.  
  2552. Resources are in the format of X resource files, but the format of text within
  2553. multiple-item resources like highlight patterns, language modes, macros,
  2554. styles, etc., are private to NEdit.  Each resource is a string which ends at
  2555. the first newline character not escaped with \, so you must be careful about
  2556. how you treat ends of lines.  While you can generally just cut and paste
  2557. indented sections, if something which was originally in the middle of a
  2558. resource string is now at the end, you must remove the \ line continuation
  2559. character(s) so it will not join the next line into the resource.  Conversely,
  2560. if something which was originally at the end of a resource is now in the
  2561. middle, you'll have to add continuation character(s) to make sure that the
  2562. resource string is properly continued from beginning to end, and possibly
  2563. newline character(s) (\n) to make sure that it is properly separated from the
  2564. next item.
  2565.  
  2566.  
  2567. X RESOURCES
  2568.         
  2569. NEdit has additional options to those provided in the Preferences menu which
  2570. are set using X resources.  Like most other X programs, NEdit can be customized
  2571. to vastly unnecessary proportions, from initial window positions down to the
  2572. font and shadow colors of each individual button (A complete discussion of how
  2573. to do this is left to books on the X Windows System).  Key binding (see KEY
  2574. BINDING) is one of the most useful of these resource settable options.
  2575.  
  2576. X resources are usually specified in a file called .Xdefaults or .Xresources in
  2577. your home directory (on VMS this is sys$login:decw$xdefaults.dat).  On some
  2578. systems, this file is read and its information attached to the X server (your
  2579. screen) when you start X.  On other systems, the .Xdefaults file is read each
  2580. time you run an X program.  When X resource values are attached to the X
  2581. server, changes to the resource file are not available to application programs
  2582. until you either run the xrdb program with the appropriate file as input, or
  2583. re-start the X server.
  2584.  
  2585. The .nedit File
  2586.  
  2587. The .nedit (saved preferences) file is in the same format as an X resource
  2588. file, and its contents can be moved into your X resource file.  One reason for
  2589. doing so would be to attach server specific preferences, such as a default font
  2590. to a particular X server.  Another reason for moving preferences into the X
  2591. resource file would be to keep preferences menu options and resource settable
  2592. options together in one place. Though the files are the same format, additional
  2593. resources should not be added to the .nedit file, they will not be read, and
  2594. NEdit modifies this file by overwriting it completely.  Note also that the
  2595. contents of the .nedit file take precedence over the values of X resources. 
  2596. Using Save Defaults after moving the contents of your .nedit file to your
  2597. .Xdefaults file will re-create the .nedit file, interfering with the options
  2598. that you have moved.
  2599.  
  2600. Selected X Resource Names
  2601.  
  2602. The following are selected NEdit resource names and default values for NEdit
  2603. options not settable via the Preferences menu (for preference resource names,
  2604. see your .nedit file):
  2605.  
  2606.     nedit.tagFile: (not defined) -- The name of a file of the type produced
  2607.         by the Unix ctags command which NEdit will load at startup time
  2608.         (see FINDING SUBROUTINE AND DATA DECLARATIONS above).  The tag file
  2609.     provides a database from which NEdit can automatically open files
  2610.     containing the definition of a particular subroutine or data type.
  2611.  
  2612.     nedit.shell: /bin/csh -- (Unix systems only) The Unix shell (command
  2613.         interpreter) to use for executing commands from the Shell menu
  2614.  
  2615.     nedit.wordDelimiters: .,/\\`'!@#%^&*()-=+{}[]":;<>? -- The characters,
  2616.         in addition to blanks and tabs, which mark the boundaries between
  2617.         words for the move-by-word (Ctrl+Arrow) and select-word (double
  2618.         click) commands.
  2619.  
  2620.     nedit.remapDeleteKey: True -- Setting this resource to False restores
  2621.         the original Motif binding of the delete key to forward-delete.
  2622.         This binding causes problems when X servers with one delete/
  2623.         backspace configuration are connected with X clients of the other.
  2624.         Users with a backspace key in the backspace/delete position and who
  2625.         use only machines with that style of keyboard can set this resource
  2626.         to False to get back the forward-delete function of the delete key.
  2627.  
  2628.     nedit.bgMenuButton: ~Shift~Ctrl~Meta~Alt<Btn3Down> -- Specification for
  2629.     mouse button / key combination to post the background menu (in the
  2630.     form of an X translation table event specification).  The event
  2631.     specification should be as specific as possible, since it will
  2632.     override less specific translation table entries.
  2633.  
  2634.     nedit.maxPrevOpenFiles: 30 -- Number of files listed in the Open
  2635.     Previous sub-menu of the File menu. Setting this to zero disables
  2636.     the Open Previous menu item and maintenance of the .neditdb file.
  2637.  
  2638.     nedit.stdOpenDialog: False -- Setting this resource to True restores the
  2639.         standard Motif style of Open dialog.  NEdit file open dialogs are
  2640.         missing a text field at the bottom of the dialog, where the file
  2641.         name can be entered as a string.  The field is removed in NEdit to
  2642.         encourage users to type file names in the list, a non-standard, but
  2643.         much faster method for finding files.
  2644.  
  2645.     nedit.printCommand: (system specific) -- Command used by the print dialog
  2646.         to print a file, i.e. lp, lpr, etc..
  2647.  
  2648.     nedit.printCopiesOption: (system specific) -- Option name used to
  2649.         specify multiple copies to the print command.  If the option should
  2650.         be separated from its argument by a space, leave a trailing space.
  2651.         If blank, no "Number of Copies" item will appear in the print dialog.
  2652.  
  2653.     nedit.printQueueOption: (system specific) -- Option name used to specify
  2654.         a print queue to the print command.  If the option should be
  2655.         separated from its argument by a space, leave a trailing space. If
  2656.         blank, no "Queue" item will appear in the print dialog.
  2657.  
  2658.     nedit.printNameOption: (system specific) -- Option name used to specify a
  2659.         job name to the print command.  If the option should be separated
  2660.         from its argument by a space, leave a trailing space. If blank, no
  2661.         job or file name will be attached to the print job or banner page.
  2662.  
  2663.     nedit.printHostOption: (system specific) -- Option name used to specify a
  2664.         host name to the print command.  If the option should be separated
  2665.         from its argument by a space, leave a trailing space. If blank, no
  2666.         "Host" item will appear in the print dialog.
  2667.  
  2668.     nedit.printDefaultQueue: (system specific) -- The name of the default
  2669.         print queue.  Used only to display in the print dialog, and has no
  2670.         effect on printing.
  2671.  
  2672.     nedit.printDefaultHost: (system specific) -- The node name of the
  2673.         default print host.  Used only to display in the print dialog, and
  2674.         has no effect on printing.
  2675.  
  2676.     nedit.multiClickTime: (system specific) -- Maximum time in milliseconds
  2677.         allowed between mouse clicks within double and triple click actions.
  2678.  
  2679.     nedit*scrollBarPlacement: BOTTOM_LEFT -- How scroll bars are placed in
  2680.         NEdit windows, as well as various lists and text fields in the
  2681.         program.  Other choices are: BOTTOM_RIGHT, TOP_LEFT, or TOP_RIGHT.
  2682.  
  2683.     nedit*text.autoWrapPastedText: False -- When Auto- Newline Wrap is turned
  2684.     on, apply automatic wrapping (which normally only applies to typed
  2685.     text) to pasted text as well.
  2686.  
  2687.     nedit*text.heavyCursor: False -- For monitors with poor resolution or
  2688.         users who have difficulty seeing the cursor, makes the cursor in the
  2689.         text editing area of the window heavier and darker.
  2690.  
  2691.     nedit*text.foreground: black -- Foreground color of the text editing area
  2692.         of the NEdit window.
  2693.  
  2694.     nedit*text.background: white -- Background color of the text editing area
  2695.         of the NEdit window.
  2696.  
  2697.     nedit*text.selectForeground: black -- Foreground (text) color for
  2698.         selections in the text editing area of the NEdit window. 
  2699.  
  2700.     nedit*text.selectBackground: gray80 -- Color for selections in the text
  2701.         editing area of the NEdit window.
  2702.  
  2703.     nedit*text.highlightForeground: white -- Foreground (text) color for
  2704.         highlights (parenthesis flashing) in the text editing area of the
  2705.         NEdit window.
  2706.  
  2707.     nedit*text.highlightBackground: red -- Color for highlights (parenthesis
  2708.         flashing) in the text editing area of the NEdit window.
  2709.  
  2710.     nedit*text.cursorForeground: black -- Color for text cursor in the text
  2711.         editing area of the NEdit window.
  2712.  
  2713.     nedit*text.blinkRate: 600 -- Blink rate of the text insertion cursor in
  2714.         milliseconds.  Set to zero to stop blinking.
  2715.  
  2716.     nedit*text.Translations: -- Modifies key bindings (see below).
  2717.  
  2718.     nedit*foreground: black -- Default foreground color for menus, dialogs,
  2719.     scroll bars, etc..
  2720.  
  2721.     nedit*background: gray70 -- Default background color for menus, dialogs,
  2722.     scroll bars, etc..
  2723.  
  2724.     nedit*fontList: helvetica-bold-14 -- Default font for menus, dialogs,
  2725.     scroll bars, etc..
  2726.  
  2727.     nc.autoStart: False -- Whether the nc program should automatically start
  2728.         an NEdit server (without prompting the user) if an appropriate server
  2729.         is not found.
  2730.  
  2731.     nc.serverCommand: nedit -server -- Command used by the nc program to
  2732.         start an NEdit server.
  2733.  
  2734. Selected NEdit Widget Names
  2735.  
  2736. You can change colors, fonts, and other characteristics, of the widgets named
  2737. below, by appending .background, .foreground, .fontList, etc., to these names:
  2738.  
  2739.     nedit*statsLine -- Statistics line
  2740.  
  2741.     nedit*menuBar -- Top-of-window menu-bar
  2742.  
  2743.     nedit*textHorScrollBar -- Horizontal scroll bar
  2744.  
  2745.     nedit*textVertScrollBar -- Vertical scroll bar
  2746.  
  2747.     nedit*helpText -- Help window text
  2748.  
  2749.     
  2750. KEY BINDING
  2751.  
  2752. There are several ways to change key bindings in NEdit.  The easiest way to add
  2753. a new key binding in NEdit is to define a macro in Preferences -> Default
  2754. Settings -> Customize Menus -> Macro Menu.  However, if you want to change
  2755. existing bindings or add a significant number of new key bindings you will need
  2756. to do so via X resources.
  2757.  
  2758. Before reading this section, you must understand how to set X resources (see
  2759. the section titled "X RESOURCES" above).  Since setting X resources is tricky,
  2760. it is also helpful when working on key-binding, to set some easier-to-verify
  2761. resource at the same time, as a simple check that the NEdit program is actually
  2762. seeing your changes.  The appres program is also very helpful in checking that
  2763. the resource settings that you make, actually reach the program for which they
  2764. are intended in the correct form.
  2765.  
  2766. Key Binding in General
  2767.  
  2768. Keyboard commands are associated with editor action routines through two
  2769. separate mechanisms in NEdit.  Commands which appear in pull-down menus have
  2770. individual resources designating a keyboard equivalent to the menu command,
  2771. called an accelerator key.  Commands which do not have an associated menu item
  2772. are bound to keys via the X toolkit translation mechanism.  The methods for
  2773. changing these two kinds of bindings are quite different.
  2774.  
  2775. Key Binding Via Translations
  2776.  
  2777. The most general way to bind actions to keys in NEdit is to use the translation
  2778. table associated with the text widget.  To add a binding to Alt+Y to insert the
  2779. string "Hi!", for example, add lines similar to the following to your X
  2780. resource file:
  2781.  
  2782.   NEdit*text.Translations: #override \n\
  2783.     Alt<Key>y: insert_string("Hi!") \n
  2784.  
  2785. The section "ACTION ROUTINES" above lists the actions available to be bound.
  2786.  
  2787. Translation tables map key and mouse presses, window operations, and other
  2788. kinds of events, to actions.  The syntax for translation tables is simplified
  2789. here, and you.  may need to refer to a book on the X window system for more
  2790. detailed information.
  2791.  
  2792. Note that accelerator resources (discussed below) override translations, and
  2793. that most Ctrl+letter and Alt+letter combinations are already bound to an
  2794. accelerator key.  To use one of these combinations from a translation table,
  2795. therefore, you must first un-bind the original menu accelerator.
  2796.  
  2797. A resource for changing a translation table consists of a keyword; #override,
  2798. #augment, or #replace; followed by lines (separated by newline characters)
  2799. pairing events with actions.  Events begin with modifiers, like Ctrl, Shift, or
  2800. Alt, followed by the event type in <>.  BtnDown, Btn1Down, Btn2Down, Btn1Up,
  2801. Key, KeyUp are valid event types.  For key presses, the event type is followed
  2802. by the name of the key.  You can specify a combination of events, such as a
  2803. sequence of key presses, by separating them with commas.  The other half of the
  2804. event/action pair is a set of actions.  These are separated from the event
  2805. specification by a colon and from each other by spaces.  Actions are names
  2806. followed by parentheses, optionally containing one or more parameters separated
  2807. by comas.
  2808.  
  2809. Changing Menu Accelerator Keys
  2810.  
  2811. The menu shortcut keys shown at the right of NEdit menu items can also be
  2812. changed via X resources.  Each menu item has two resources associated with it,
  2813. accelerator, the event to trigger the menu item; and acceleratorText, the
  2814. string shown in the menu.  The form of the accelerator resource is the same as
  2815. events for translation table entries discussed above, though multiple keys and
  2816. other subtleties are not allowed.  The resource name for a menu is the title in
  2817. lower case, followed by "Menu", the resource name of menu item is the name in
  2818. lower case, run together, with words separated by caps, and all punctuation
  2819. removed.  For example, to change Cut to Ctrl+X, you would add the following to
  2820. your .Xdefaults file:
  2821.  
  2822.     nedit*editMenu.cut.accelerator: Ctrl<Key>x
  2823.     nedit*editMenu.cut.acceleratorText: Ctrl+X
  2824.  
  2825. Accelerator keys with optional shift key modifiers, like Find..., have an
  2826. additional accelerator resource with Shift appended to the name.  For example:
  2827.  
  2828.     nedit*searchMenu.find.acceleratorText: [Shift]Alt+F
  2829.     nedit*searchMenu.find.accelerator: Alt<Key>f
  2830.     nedit*searchMenu.findShift.accelerator: Shift Alt<Key>f
  2831.  
  2832.  
  2833. WRITING SYNTAX HIGHLIGHTING PATTERNS
  2834.  
  2835. Patterns are the mechanism by which syntax highlighting (see SYNTAX
  2836. HIGHLIGHTING above) is programmed in NEdit, that is, how it decides what to
  2837. highlight in a given language.  To create syntax highlighting patterns for a
  2838. new language, or to modify existing patterns, select "Patterns for
  2839. Highlighting" from "Syntax Highlighting" sub-section of the "Default Settings"
  2840. sub-menu of the "Preferences" menu.
  2841.  
  2842. First, a word of caution.  As with regular expression matching in general, it
  2843. is quite possible to write patterns which are so inefficient that they
  2844. essentially lock up the editor as they recursively re-examine the entire
  2845. contents of the file thousands of times.  With the multiplicity of patterns,
  2846. the possibility of a lock-up is significantly increased in syntax
  2847. highlighting.  When working on highlighting patterns, be sure to save your work
  2848. frequently.
  2849.  
  2850. NEdit's syntax highlighting is unusual in that it works in real-time (as you
  2851. type), and yet is completely programmable using standard regular expression
  2852. notation.  Other syntax highlighting editors usually fall either into the
  2853. category of fully programmable but unable to keep up in real-time, or real-time
  2854. but limited programmability.  The additional burden that NEdit places on
  2855. pattern writers in order to achieve this speed/flexibility mix, is to force
  2856. them to state self-imposed limitations on the amount of context that patterns
  2857. may examine when re-parsing after a change.  While the "Pattern Context
  2858. Requirements" heading is near the end of this section, it is not optional, and
  2859. must be understood before making any any serious effort at pattern writing.
  2860.  
  2861. In its simplest form, a highlight pattern consists of a regular expression to
  2862. match, along with a style representing the font an color for displaying any
  2863. text which matches that expression.  To bold the word, "highlight", wherever it
  2864. appears the text, the regular expression simply would be the word "highlight". 
  2865. The style (selected from the menu under the heading of "Highlight Style")
  2866. determines how the text will be drawn.  To bold the text, either select an
  2867. existing style, such as "Keyword", which bolds text, or create a new style and
  2868. select it under Highlight Style.
  2869.  
  2870. The full range of regular expression capabilities can be applied in such a
  2871. pattern, with the single caveat that the expression must conclusively match or
  2872. not match, within the pre-defined context distance (as discussed below under
  2873. Pattern Context Requirements).
  2874.  
  2875. To match longer ranges of text, particularly any constructs which exceed the
  2876. requested context, you must use a pattern which highlights text between a
  2877. starting and ending regular expression match.  To do so, select "Highlight text
  2878. between starting and ending REs" under "Matching", and enter both a starting
  2879. and ending regular expression.  For example, to highlight everything between
  2880. double quotes, you would enter a double quote character in both the starting
  2881. and ending regular expression fields.  Patterns with both a beginning and
  2882. ending expression span all characters between the two expressions, including
  2883. newlines.
  2884.  
  2885. Again, the limitation for automatic parsing to operate properly is that both
  2886. expressions must match within the context distance stated for the pattern set.
  2887.  
  2888. With the ability to span large distances, comes the responsibility to recover
  2889. when things go wrong.  Remember that syntax highlighting is called upon to
  2890. parse incorrect or incomplete syntax as often as correct syntax.  To stop a
  2891. pattern short of matching its end expression, you can specify an error
  2892. expression, which stops the pattern from gobbling up more than it should.  For
  2893. example, if the text between double quotes shouldn't contain newlines, the
  2894. error expression might be "$".  As with both starting and ending expressions,
  2895. error expressions must also match within the requested context distance.
  2896.  
  2897. Coloring Sub-Expressions
  2898.  
  2899. It is also possible to color areas of text within a regular expression match. 
  2900. A pattern of this type associates a style with sub-expressions references of
  2901. the parent pattern (as used in regular expression substitution patterns, see
  2902. the section titled: REGULAR EXPRESSIONS).  Sub-expressions of both the starting
  2903. and ending patterns may be colored.  For example, if the parent pattern has a
  2904. starting expression "\<", and end expression "\>", (for highlighting all of the
  2905. text contained within angle brackets), a sub-pattern using "\0" in both the
  2906. starting and ending expression fields could color the brackets differently from
  2907. the intervening text.  A quick shortcut to typing in pattern names in the
  2908. Parent Pattern field is to use the middle mouse button to drag them from the
  2909. Patterns list.
  2910.  
  2911. Hierarchical Patterns
  2912.  
  2913. A hierarchical sub-pattern, is identical to a top level pattern, but is invoked
  2914. only between the beginning and ending expression matches of its parent
  2915. pattern.  Like the sub-expression coloring patterns discussed above, it is
  2916. associated with a parent pattern using the Parent Pattern field in the pattern
  2917. specification.  Pattern names can be dragged from the pattern list with the
  2918. middle mouse button to the Parent Pattern field.
  2919.  
  2920. After the start expression of the parent pattern matches, the syntax
  2921. highlighting parser searches for either the parent's end pattern or a matching
  2922. sub-pattern.  When a sub-pattern matches, control is not returned to the parent
  2923. pattern until the entire sub-pattern has been parsed, regardless of whether the
  2924. parent's end pattern appears in the text matched by the sub-pattern.
  2925.  
  2926. The most common use for this capability is for coloring sub-structure of
  2927. language constructs (smaller patterns embedded in larger patterns). 
  2928. Hierarchical patterns can also simplify parsing by having sub-patterns "hide"
  2929. special syntax from parent patterns, such as special escape sequences or
  2930. internal comments.
  2931.  
  2932. There is no depth limit in nesting hierarchical sub-patterns, but beyond the
  2933. third level of nesting, automatic re-parsing will sometimes have to re-parse
  2934. more than the requested context distance to guaranty a correct parse (which can
  2935. slow down the maximum rate at which the user can type if large sections of text
  2936. are matched only by deeply nested patterns).
  2937.  
  2938. While this is obviously not a complete hierarchical language parser it is still
  2939. useful in many text coloring situations.  As a pattern writer, your goal is not
  2940. to completely cover the language syntax, but to generate colorings that are
  2941. useful to the programmer.  Simpler patterns are usually more efficient and also
  2942. more robust when applied to incorrect code.
  2943.  
  2944. Deferred (Pass-2) Parsing
  2945.  
  2946. NEdit does pattern matching for syntax highlighting in two passes.  The first
  2947. pass is applied to the entire file when syntax highlighting is first turned on,
  2948. and to new ranges of text when they are initially read or pasted in.  The
  2949. second pass is applied only as needed when text is exposed (scrolled in to
  2950. view).
  2951.  
  2952. If you have a particularly complex set of patterns, and parsing is beginning to
  2953. add a noticeable delay to opening files or operations which change large
  2954. regions of text, you can defer some of that parsing from startup time, to when
  2955. it is actually needed for viewing the text.  Deferred parsing can only be used
  2956. with single expression patterns, or begin/end patterns which match entirely
  2957. within the requested context distance.  To defer the parsing of a pattern to
  2958. when the text is exposed, click on the Pass-2 pattern type button in the
  2959. highlight patterns dialog.
  2960.  
  2961. Sometimes a pattern can't be deferred, not because of context requirements, but
  2962. because it must run concurrently with pass-1 (non-deferred) patterns.  If they
  2963. didn't run concurrently, a pass-1 pattern might incorrectly match some of the
  2964. characters which would normally be hidden inside of a sequence matched by the
  2965. deferred pattern.  For example, C has character constants enclosed in single
  2966. quotes.  These typically do not cross line boundaries, meaning they can be
  2967. parsed entirely within the context distance of the C pattern set and should be
  2968. good candidates for deferred parsing.  However, they can't be deferred because
  2969. they can contain sequences of characters which can trigger pass-one patterns.
  2970. Specifically, the sequence, '\"', contains a double quote character, which
  2971. would be matched by the string pattern and interpreted as introducing a string.
  2972.  
  2973. Pattern Context Requirements
  2974.  
  2975. The context requirements of a pattern set state how much additional text around
  2976. any change must be examined to guaranty that the patterns will match what they
  2977. are intended to match.  Context requirements are a promise by NEdit to the
  2978. pattern writer, that the regular expressions in his/her patterns will be
  2979. matched against at least <line context> lines and <character context>
  2980. characters, around any modified text.  Combining line and character
  2981. requirements guaranty that both will be met.
  2982.  
  2983. Automatic re-parsing happens on EVERY KEYSTROKE, so the amount of context which
  2984. must be examined is very critical to typing efficiency.  The more complicated
  2985. your patterns, the more critical the context becomes.  To cover all of the
  2986. keywords in a typical language, without affecting the maximum rate at which
  2987. users can enter text, you may be limited to just a few lines and/or a few
  2988. hundred characters of context.
  2989.  
  2990. The default context distance is 1 line, with no minimum character requirement. 
  2991. There are several benefits to sticking with this default.  One is simply that
  2992. it is easy to understand and to comply with.  Regular expression notation is
  2993. designed around single line matching.  To span lines in a regular expression,
  2994. you must explicitly mention the newline character "\n", and matches which are
  2995. restricted to a single line are virtually immune to lock-ups.  Also, if you can
  2996. code your patterns to work within a single line of context, without an
  2997. additional character-range context requirement, the parser can take advantage
  2998. the fact that patterns don't cross line boundaries, and nearly double its
  2999. efficiency over a one-line and 1-character context requirement.  (In a single
  3000. line context, you are allowed to match newlines, but only as the first and/or
  3001. last character.)
  3002.  
  3003.  
  3004. WRITING SMART INDENT MACROS
  3005.  
  3006. Smart indent macros can be written for any language, but are usually more
  3007. difficult to write than highlighting patterns.  A good place to start, of
  3008. course, is to look at the existing macros for C and C++.
  3009.  
  3010. Smart indent macros for a language mode consist of standard NEdit macro
  3011. language code attached to any or all of the following three activation
  3012. conditions: 1) When smart indent is first turned on for a text window
  3013. containing code of the language, 2) When a newline is typed and smart indent
  3014. is expected, 3) after any character is typed.  To attach macro code to any of
  3015. these code "hooks", enter it in the appropriate section in the Preferences ->
  3016. Default Settings -> Auto Indent -> Program Smart Indent dialog.
  3017.  
  3018. Typically most of the code should go in the initialization section, because
  3019. that is the appropriate place for subroutine definitions, and smart indent
  3020. macros are complicated enough that you are not likely to want to write them as
  3021. one monolithic run of code.  You may also put code in the Common/Shared
  3022. Initialization section (accessible through the button in the upper left corner
  3023. of the dialog).  Unfortunately, since the C/C++ macros also reside in the
  3024. common/shared section, when you add code there, you run some risk of missing
  3025. out on future upgrades to these macros, because your changes will override the
  3026. built-in defaults.
  3027.  
  3028. The newline macro is invoked after the user types a newline, but before the
  3029. newline is entered in the buffer.  It takes a single argument ($1) which is the
  3030. position at which the newline will be inserted.  It must return the number of
  3031. characters of indentation the line should have, or -1.  A return value of -1
  3032. means to do a standard auto-indent.  You must supply a newline macro, but the
  3033. code: "return -1" (auto-indent), or "return 0" (no indent) is sufficient.
  3034.  
  3035. The type-in macro takes two arguments.  $1 is the insert position, and $2 is
  3036. the character just inserted, and does not return a value.  You can do just
  3037. about anything here, but keep in mind that this macro is executed for every
  3038. keystroke typed, so if you try to get too fancy, you may degrade performance.
  3039.  
  3040.  
  3041. THE NEDIT COMMAND LINE
  3042.  
  3043. nedit [-read] [-create] [-line n | +n] [-server] [-do command] [-tags file]
  3044.     [-tabs n] [-wrap] [-nowrap] [-autowrap] [-autoindent] [-noautoindent]
  3045.     [-autosave] [-noautosave] [-lm languagemode] [-rows n] [-columns n]
  3046.     [-font font] [-geometry geometry] [-iconic] [-noiconic] [-svrname name]
  3047.     [-display [host]:server[.screen] [-background color] [-foreground color]
  3048.     [-xrm resourcestring] [-import file] [file...]
  3049.  
  3050.     -read -- Open the file Read Only regardless of the actual file
  3051.         protection.
  3052.  
  3053.     -create -- Don't warn about file creation when a file doesn't exist.
  3054.  
  3055.     -line n (or +n) -- Go to line number n
  3056.  
  3057.     -server -- Designate this session as an NEdit server, for processing
  3058.         commands from the nc program.  nc can be used to interface NEdit
  3059.         to code development environments, mailers, etc., or just as a
  3060.         quick way to open files from the shell command line without
  3061.         starting a new NEdit session.
  3062.  
  3063.     -do command -- Execute an NEdit macro or action on each file following
  3064.         the -do argument on the command line.  -do is particularly useful
  3065.         from the nc program, where nc -do can remotely execute commands in
  3066.         an nedit -server session.
  3067.  
  3068.     -tags file -- Load a file of directions for finding definitions of
  3069.         program subroutines and data objects.  The file must be of the
  3070.         format generated by the Unix ctags command.
  3071.  
  3072.     -tabs n -- Set tab stops every n characters.
  3073.  
  3074.     -wrap, -nowrap -- Wrap long lines at the right edge of the window
  3075.     rather than continuing them past it.  (Continuous Wrap mode)
  3076.     
  3077.     -autowrap, -noautowrap -- Wrap long lines when the cursor reaches
  3078.     the right edge of the window by inserting newlines at word
  3079.     boundaries.  (Auto Newline Wrap mode)
  3080.  
  3081.     -autoindent, -noautoindent -- Maintain a running indent.
  3082.  
  3083.     -autosave, -noautosave -- Maintain a backup copy of the file being
  3084.         edited under the name ~filename  (on Unix) or _filename (on VMS).
  3085.  
  3086.     -lm languagemode -- Initial language mode used for editing
  3087.     succeeding files.
  3088.  
  3089.     -rows n -- Default height in characters for an editing window.
  3090.  
  3091.     -columns n -- Default width in characters for an editing window.
  3092.  
  3093.     -font font (or -fn font) -- Font for text being edited (Font for
  3094.         menus and dialogs can be set with -xrm "*fontList:font").
  3095.  
  3096.     -geometry geometry (or -g geometry) -- The initial size and/or
  3097.         location of editor windows.  The argument has the form:
  3098.  
  3099.            [<width>x<height>][+|-][<xoffset>[+|-]<yoffset>]
  3100.  
  3101.         where <width> and <height> are the desired width and height of
  3102.         the window, and <xoffset> and <yoffset> are the distance from the
  3103.         edge of the screen to the window, + for top or left, - for bottom
  3104.         or right. -geometry can be specified for individual files on the
  3105.     command line.
  3106.  
  3107.     -iconic, -noiconic -- Initial window state for succeeding files.
  3108.  
  3109.     -display [host]:server[.screen] -- The name of the X server to use.
  3110.         host specifies the machine, server specifies the display server
  3111.         number, and screen specifies the screen number.  host or screen
  3112.         can be omitted and default to the local machine, and screen 0.
  3113.  
  3114.     -background color (or -bg color) -- Background color. (background
  3115.         color for text can be set separately with:
  3116.         -xrm "nedit*text.background: color").
  3117.  
  3118.     -foreground color (or -fg color) -- Foreground color. (foreground
  3119.         color for text can be set separately with:
  3120.          -xrm "nedit*text.foreground: color").
  3121.  
  3122.     -xrm resourcestring -- Set the value of an X resource to override a
  3123.         default value (see CUSTOMIZATION).
  3124.  
  3125.     -svrname name -- When starting nedit in server mode, name the
  3126.     server, such that it responds to requests only when nc is given
  3127.     a correspoding -svrname argument.  By naming servers, you can
  3128.     run several simultaneously, and direct files and commands
  3129.     specifically to any one.
  3130.  
  3131.     -import file -- loads an additional preferences file on top of the
  3132.        existing defaults saved in your .nedit file.  To incorporate
  3133.        macros, language modes, and highlight patterns and styles
  3134.        written by other users, run nedit with -import <file>, then
  3135.        re-save your .nedit file with Preferences -> Save Defaults.
  3136.  
  3137.  
  3138. SERVER MODE AND NC
  3139.  
  3140. NEdit can be operated on its own, or as a two-part client/server application. 
  3141. Client/server mode is useful for integrating NEdit with software development
  3142. environments, mailers, and other programs; or just as a quick way to open files
  3143. from the shell command line without starting a new NEdit session.
  3144.  
  3145. To run NEdit in server mode, type:
  3146.  
  3147. nedit -server
  3148.  
  3149. NEdit can also be started in server mode via the nc program when no servers are
  3150. available.
  3151.  
  3152. The nc (for NEdit Client) program, which is distributed along with nedit, sends
  3153. commands to an nedit server to open files, select lines, or execute editor
  3154. actions.  It accepts a limited set of the nedit command line options: -read,
  3155. -create, -line (or +n), -do, and a list of file names.  Listing a file on the
  3156. nc command line means, open it if it is not already open and bring the window
  3157. to the front.  -read and -create affect only newly opened files, but -line and
  3158. -do can also be used on files which are already open (See  NEDIT COMMAND LINE
  3159. for more information).
  3160.  
  3161. In typical Unix style, arguments affect the files which follow them on the
  3162. command line, for example:
  3163.  
  3164.     incorrect:   nc file.c -line 25
  3165.     correct:     nc -line 25 file.c
  3166.  
  3167. -read, -create, and -line affect all of the files which follow them on the
  3168. command line.  The -do macro is executed only once, on the next file on the
  3169. line.  -do without a file following it on the command line, executes the macro
  3170. on the first available window (presumably when you give a -do command without a
  3171. corresponding file or window, you intend it to do something independent of the
  3172. window in which it happens execute).
  3173.  
  3174. nc also accepts one command line option of its own, -noask (or -ask), which
  3175. instructs it whether to automatically start a server if one is not available. 
  3176. This is also settable via the X resource, nc.autoStart (See X RESOURCES above).
  3177.  
  3178. Sometimes it is useful to have more than one NEdit server running, for example
  3179. to keep mail and programming work separate, or more importantly for working
  3180. with tools like ClearCase which provide different views of the file system from
  3181. different shells.  The option, -svrname, to both nedit and nc, allow you to
  3182. start, and communicate with, separate named servers.  A named server responds
  3183. only to requests with the corresponding -svrname argument.
  3184.  
  3185. Communication between nc and nedit is through the X display.  So as long as X
  3186. windows is set up and working properly, nc will will work properly as well.  nc
  3187. uses the DISPLAY environment variable, the machine name and your user name to
  3188. find the appropriate server, meaning, if you have several machines sharing a
  3189. common file system, nc will not be able to find a server that is running on a
  3190. machine with a different host name, even though it may be perfectly appropriate
  3191. for editing a given file.
  3192.  
  3193. The command which nc uses to start an nedit server is settable via the X
  3194. resource nc.serverCommand, by default, "nedit -server".
  3195.  
  3196.  
  3197. CRASH RECOVERY
  3198.  
  3199. If a system crash, network failure, X server crash, or program error should
  3200. happen while you are editing a file, you can easily recover most of your work.
  3201. NEdit maintains a backup file which it updates periodically (every 8 editing
  3202. operations or 30 characters typed under Unix, or 80 characters under VMS).
  3203. This file is has the same name as the file that you are editing, but with the
  3204. character "~" (tilde) on Unix or "_" (underscore) on VMS prefixed to the name.
  3205. To recover a file after a crash, simply rename the file to remove the tilde 
  3206. or underscore character, replacing the older version of the file.  Because 
  3207. several of the Unix shells consider the tilde to be a special character, you 
  3208. may have to prefix the character with a "\" (backslash) when you move or 
  3209. delete an NEdit backup file.
  3210.  
  3211. Example, to recover the file called "help.c" type the command:
  3212.  
  3213.     mv \~help.c help.c
  3214.     
  3215. A minor caveat, is that if the file you were editing was in MS DOS format, the
  3216. backup file will be in Unix format, and you will need to open the backup file
  3217. in NEdit and change the file format back to MS DOS via the Save As... dialog
  3218. (or use the Unix unix2dos command outside of NEdit).
  3219.  
  3220.  
  3221. SOLUTIONS TO COMMON PROBLEMS
  3222.  
  3223. For a much more comprehensive list of common problems and solutions, see the
  3224. NEdit FAQ.  The latest version of the FAQ can always be found on the nedit web
  3225. site at: http://nedit.org.
  3226.  
  3227. P: No files are shown in the "Files" list in the Open... dialog.
  3228. S: When you use the "Filter" field, include the file specification or a
  3229.    complete directory specification, including the trailing "/" on Unix.  (See
  3230.    Help in the Open... dialog).
  3231.  
  3232. P: Keyboard shortcuts for menu items don't work.
  3233. S: Be sure the Caps Lock and Num Lock keys are both unlocked.  In Motif
  3234.    programs, these keys prevent the menu accelerators from working.
  3235.  
  3236. P: Find Again and Replace Again don't continue in the same direction as the
  3237.    original Find or Replace.
  3238. S: Find Again and Replace Again don't use the direction of the original search. 
  3239.    The Shift key controls the direction: Ctrl+G means forward, Shift+Ctrl+G
  3240.    means backward.
  3241.  
  3242. P: Preferences specified in the Preferences menu don't seem to get saved when I
  3243.    select Save Defaults.
  3244. S: NEdit has two kinds of preferences: 1) per-window preferences, in the
  3245.    Preferences menu, and 2) default settings for preferences in newly created
  3246.    windows, in the Default Settings sub-menu of the Preferences menu.  Per-
  3247.    window preferences are not saved by Save Defaults, only Default Settings.
  3248.  
  3249. P: Columns and indentation don't line up.
  3250. S: NEdit is using a proportional width font.  Set the font to a fixed style
  3251.    (see PREFERENCES).
  3252.  
  3253. P: NEdit performs poorly on very large files.
  3254. S: Turn off Incremental Backup.  With Incremental Backup on, NEdit periodically
  3255.    writes a full copy of the file to disk.
  3256.  
  3257. P: Commands added to the Shell Commands menu (Unix only) don't output anything
  3258.    until they are finished executing.
  3259. S: If the command output is directed to a dialog, or the input is from a
  3260.    selection, output is collected together and held until the command
  3261.    completes.  De-select both of the options and the output will be shown
  3262.    incrementally as the command executes.
  3263.  
  3264. P: Dialogs don't automatically get keyboard focus when they pop up.
  3265. S: Most X Window managers allow you to choose between two categories of
  3266.    keyboard focus models: pointer focus, and explicit focus.  Pointer focus
  3267.    means that as you move the mouse around the screen, the window under the
  3268.    mouse automatically gets the keyboard focus.  NEdit users who use this focus
  3269.    model should set "Popups Under Pointer" in the Default Settings sub menu of
  3270.    the preferences menu in NEdit.  Users with the explicit focus model, in some
  3271.    cases, may have problems with certain dialogs, such as Find and Replace.  In
  3272.    MWM this is caused by the mwm resource startupKeyFocus being set to False
  3273.    (generally a bad choice for explicit focus users).  NCDwm users should use
  3274.    the focus model "click" instead of "explicit", again, unless you have set it
  3275.    that way to correct specific problems, this is the appropriate setting for
  3276.    most explicit focus users.
  3277.  
  3278. P: The Delete key doesn't forward-delete.
  3279. S: See the X Resources section on nedit.remapDeleteKey.
  3280.  
  3281. P: NEdit crashes when I try to paste text in to a text field in a dialog (like
  3282.    Find or Replace) on my SunOS system.
  3283. S: On many SunOS systems, you have to set up an nls directory before various
  3284.    inter-client communication features of Motif will function properly.  There
  3285.    are instructions in README.sun in /pub/nedit/v4_0_1 on ftp.fnal.gov, as well
  3286.    as a tar file containg a complete nls directory: ftp://ftp.fnal.gov/pub/
  3287.    nedit/v4_0_2/individual/README.sun.  This contains directions for setting up
  3288.    an nls directory, which is required by Motif for handling copy and paste to
  3289.    Motif text fields. 
  3290.  
  3291.  
  3292. KNOWN BUGS
  3293.  
  3294. Below is the list of known bugs which affect NEdit.  The bugs your copy of
  3295. NEdit will exhibit depend on which system you are running and with which Motif
  3296. libraries it was built.  Note that there are now Motif 1.2 and/or 2.0 libraries
  3297. available on ALL supported platforms, and as you can see below there are far
  3298. fewer bugs in Motif 1.2, so it is in your best interest to upgrade your system.
  3299.  
  3300. BUG: Operations between rectangular selections on overlapping lines do nothing.
  3301. WORKAROUND: None.  These operations are very complicated and you probably
  3302.      wouldn't get what you expected anyhow.
  3303.  
  3304. BUG: Cut and Paste menu items fail, or possibly crash, for very large
  3305.      (multi-megabyte) selections.
  3306. WORKAROUND: Use selection copy (middle mouse button click) for transferring
  3307.      larger quantities of data.  Cut and Paste save the copied text in server
  3308.      memory, which is usually limited.
  3309.  
  3310.  
  3311. REPORTING BUGS
  3312.  
  3313. The nedit developers subscribe to both discuss@nedit.org and develop@nedit.org,
  3314. either of which may be used for reporting bugs.  If you're not sure, or you
  3315. think the report might be of interest to the general nedit user community, send
  3316. the report to discuss@nedit.org.  If it's something obvious and boring, like we
  3317. misspelled "anemometer" in the on-line help, send it to develop.  If you don't
  3318. want to subscribe to these lists, please add a note to your mail about cc'ing
  3319. you on responses.
  3320.  
  3321.  
  3322. MAILING LISTS
  3323.  
  3324. There are two separate mailing lists for nedit users, and one for developers.
  3325. Users may post to the developer mailing list to report bugs and communicate
  3326. with the nedit developers.  Remember that nedit is entirely a volunteer effort,
  3327. so please ask questions first to the discussion list, and do your share to
  3328. answer other users questions as well.  The lists are:
  3329.  
  3330.     discuss@nedit.org  -- General discussion, questions and answers among
  3331.                           nedit users and developers.
  3332.              
  3333.     announce@nedit.org -- A lov-volume mailing list for annoumcing new
  3334.                           versions.
  3335.              
  3336.     develop@nedit.org  -- Communication among and with nedit developers.
  3337.  
  3338.             [... List subscription information goes here ...]
  3339.  
  3340. GNU GENERAL PUBLIC LICENSE
  3341.  
  3342. Version 2, June 1991
  3343.  
  3344. Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
  3345. Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute verbatim
  3346. copies of this license document, but changing it is not allowed.
  3347.  
  3348. Preamble
  3349.  
  3350. The licenses for most software are designed to take away your freedom to share
  3351. and change it. By contrast, the GNU General Public License is intended to
  3352. guarantee your freedom to share and change free software--to make sure the
  3353. software is free for all its users. This General Public License applies to most
  3354. of the Free Software Foundation's software and to any other program whose
  3355. authors commit to using it. (Some other Free Software Foundation software is
  3356. covered by the GNU Library General Public License instead.) You can apply it to
  3357. your programs, too.
  3358.  
  3359. When we speak of free software, we are referring to freedom, not price. Our
  3360. General Public Licenses are designed to make sure that you have the freedom to
  3361. distribute copies of free software (and charge for this service if you wish),
  3362. that you receive source code or can get it if you want it, that you can change
  3363. the software or use pieces of it in new free programs; and that you know you
  3364. can do these things.
  3365.  
  3366. To protect your rights, we need to make restrictions that forbid anyone to deny
  3367. you these rights or to ask you to surrender the rights. These restrictions
  3368. translate to certain responsibilities for you if you distribute copies of the
  3369. software, or if you modify it.
  3370.  
  3371. For example, if you distribute copies of such a program, whether gratis or for
  3372. a fee, you must give the recipients all the rights that you have. You must make
  3373. sure that they, too, receive or can get the source code. And you must show them
  3374. these terms so they know their rights.
  3375.  
  3376. We protect your rights with two steps: (1) copyright the software, and (2)
  3377. offer you this license which gives you legal permission to copy, distribute
  3378. and/or modify the software.
  3379.  
  3380. Also, for each author's protection and ours, we want to make certain that
  3381. everyone understands that there is no warranty for this free software. If the
  3382. software is modified by someone else and passed on, we want its recipients to
  3383. know that what they have is not the original, so that any problems introduced
  3384. by others will not reflect on the original authors' reputations.
  3385.  
  3386. Finally, any free program is threatened constantly by software patents. We wish
  3387. to avoid the danger that redistributors of a free program will individually
  3388. obtain patent licenses, in effect making the program proprietary. To prevent
  3389. this, we have made it clear that any patent must be licensed for everyone's
  3390. free use or not licensed at all.
  3391.  
  3392. The precise terms and conditions for copying, distribution and modification
  3393. follow.
  3394.  
  3395. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
  3396. MODIFICATION
  3397.  
  3398. 0. This License applies to any program or other work which contains a notice
  3399. placed by the copyright holder saying it may be distributed under the terms of
  3400. this General Public License. The "Program", below, refers to any such program
  3401. or work, and a "work based on the Program" means either the Program or any
  3402. derivative work under copyright law: that is to say, a work containing the
  3403. Program or a portion of it, either verbatim or with modifications and/or
  3404. translated into another language. (Hereinafter, translation is included without
  3405. limitation in the term "modification".) Each licensee is addressed as "you".
  3406.  
  3407. Activities other than copying, distribution and modification are not covered by
  3408. this License; they are outside its scope. The act of running the Program is not
  3409. restricted, and the output from the Program is covered only if its contents
  3410. constitute a work based on the Program (independent of having been made by
  3411. running the Program). Whether that is true depends on what the Program does.
  3412.  
  3413. 1. You may copy and distribute verbatim copies of the Program's source code as
  3414. you receive it, in any medium, provided that you conspicuously and
  3415. appropriately publish on each copy an appropriate copyright notice and
  3416. disclaimer of warranty; keep intact all the notices that refer to this License
  3417. and to the absence of any warranty; and give any other recipients of the
  3418. Program a copy of this License along with the Program.
  3419.  
  3420. You may charge a fee for the physical act of transferring a copy, and you may
  3421. at your option offer warranty protection in exchange for a fee.
  3422.  
  3423. 2. You may modify your copy or copies of the Program or any portion of it, thus
  3424. forming a work based on the Program, and copy and distribute such modifications
  3425. or work under the terms of Section 1 above, provided that you also meet all of
  3426. these conditions:
  3427.  
  3428. a) You must cause the modified files to carry prominent notices stating that
  3429. you changed the files and the date of any change.
  3430.  
  3431. b) You must cause any work that you distribute or publish, that in whole or in
  3432. part contains or is derived from the Program or any part thereof, to be
  3433. licensed as a whole at no charge to all third parties under the terms of this
  3434. License.
  3435.  
  3436. c) If the modified program normally reads commands interactively when run, you
  3437. must cause it, when started running for such interactive use in the most
  3438. ordinary way, to print or display an announcement including an appropriate
  3439. copyright notice and a notice that there is no warranty (or else, saying that
  3440. you provide a warranty) and that users may redistribute the program under these
  3441. conditions, and telling the user how to view a copy of this License.
  3442. (Exception: if the Program itself is interactive but does not normally print
  3443. such an announcement, your work based on the Program is not required to print
  3444. an announcement.)
  3445.  
  3446. These requirements apply to the modified work as a whole. If identifiable
  3447. sections of that work are not derived from the Program, and can be reasonably
  3448. considered independent and separate works in themselves, then this License, and
  3449. its terms, do not apply to those sections when you distribute them as separate
  3450. works. But when you distribute the same sections as part of a whole which is a
  3451. work based on the Program, the distribution of the whole must be on the terms
  3452. of this License, whose permissions for other licensees extend to the entire
  3453. whole, and thus to each and every part regardless of who wrote it.
  3454.  
  3455. Thus, it is not the intent of this section to claim rights or contest your
  3456. rights to work written entirely by you; rather, the intent is to exercise the
  3457. right to control the distribution of derivative or collective works based on
  3458. the Program.
  3459.  
  3460. In addition, mere aggregation of another work not based on the Program with the
  3461. Program (or with a work based on the Program) on a volume of a storage or
  3462. distribution medium does not bring the other work under the scope of this
  3463. License.
  3464.  
  3465. 3. You may copy and distribute the Program (or a work based on it, under
  3466. Section 2) in object code or executable form under the terms of Sections 1 and
  3467. 2 above provided that you also do one of the following:
  3468.  
  3469. a) Accompany it with the complete corresponding machine-readable source code,
  3470. which must be distributed under the terms of Sections 1 and 2 above on a medium
  3471. customarily used for software interchange; or,
  3472.  
  3473. b) Accompany it with a written offer, valid for at least three years, to give
  3474. any third party, for a charge no more than your cost of physically performing
  3475. source distribution, a complete machine-readable copy of the corresponding
  3476. source code, to be distributed under the terms of Sections 1 and 2 above on a
  3477. medium customarily used for software interchange; or,
  3478.  
  3479. c) Accompany it with the information you received as to the offer to distribute
  3480. corresponding source code. (This alternative is allowed only for noncommercial
  3481. distribution and only if you received the program in object code or executable
  3482. form with such an offer, in accord with Subsection b above.)
  3483.  
  3484. The source code for a work means the preferred form of the work for making
  3485. modifications to it. For an executable work, complete source code means all the
  3486. source code for all modules it contains, plus any associated interface
  3487. definition files, plus the scripts used to control compilation and installation
  3488. of the executable. However, as a special exception, the source code distributed
  3489. need not include anything that is normally distributed (in either source or
  3490. binary form) with the major components (compiler, kernel, and so on) of the
  3491. operating system on which the executable runs, unless that component itself
  3492. accompanies the executable.
  3493.  
  3494. If distribution of executable or object code is made by offering access to copy
  3495. from a designated place, then offering equivalent access to copy the source
  3496. code from the same place counts as distribution of the source code, even though
  3497. third parties are not compelled to copy the source along with the object code.
  3498.  
  3499. 4. You may not copy, modify, sublicense, or distribute the Program except as
  3500. expressly provided under this License. Any attempt otherwise to copy, modify,
  3501. sublicense or distribute the Program is void, and will automatically terminate
  3502. your rights under this License. However, parties who have received copies, or
  3503. rights, from you under this License will not have their licenses terminated so
  3504. long as such parties remain in full compliance.
  3505.  
  3506. 5. You are not required to accept this License, since you have not signed it.
  3507. However, nothing else grants you permission to modify or distribute the Program
  3508. or its derivative works. These actions are prohibited by law if you do not
  3509. accept this License. Therefore, by modifying or distributing the Program (or
  3510. any work based on the Program), you indicate your acceptance of this License to
  3511. do so, and all its terms and conditions for copying, distributing or modifying
  3512. the Program or works based on it.
  3513.  
  3514. 6. Each time you redistribute the Program (or any work based on the Program),
  3515. the recipient automatically receives a license from the original licensor to
  3516. copy, distribute or modify the Program subject to these terms and conditions.
  3517. You may not impose any further restrictions on the recipients' exercise of the
  3518. rights granted herein. You are not responsible for enforcing compliance by
  3519. third parties to this License.
  3520.  
  3521. 7. If, as a consequence of a court judgment or allegation of patent
  3522. infringement or for any other reason (not limited to patent issues), conditions
  3523. are imposed on you (whether by court order, agreement or otherwise) that
  3524. contradict the conditions of this License, they do not excuse you from the
  3525. conditions of this License. If you cannot distribute so as to satisfy
  3526. simultaneously your obligations under this License and any other pertinent
  3527. obligations, then as a consequence you may not distribute the Program at all.
  3528. For example, if a patent license would not permit royalty-free redistribution
  3529. of the Program by all those who receive copies directly or indirectly through
  3530. you, then the only way you could satisfy both it and this License would be to
  3531. refrain entirely from distribution of the Program.
  3532.  
  3533. If any portion of this section is held invalid or unenforceable under any
  3534. particular circumstance, the balance of the section is intended to apply and
  3535. the section as a whole is intended to apply in other circumstances.
  3536.  
  3537. It is not the purpose of this section to induce you to infringe any patents or
  3538. other property right claims or to contest validity of any such claims; this
  3539. section has the sole purpose of protecting the integrity of the free software
  3540. distribution system, which is implemented by public license practices. Many
  3541. people have made generous contributions to the wide range of software
  3542. distributed through that system in reliance on consistent application of that
  3543. system; it is up to the author/donor to decide if he or she is willing to
  3544. distribute software through any other system and a licensee cannot impose that
  3545. choice.
  3546.  
  3547. This section is intended to make thoroughly clear what is believed to be a
  3548. consequence of the rest of this License.
  3549.  
  3550. 8. If the distribution and/or use of the Program is restricted in certain
  3551. countries either by patents or by copyrighted interfaces, the original
  3552. copyright holder who places the Program under this License may add an explicit
  3553. geographical distribution limitation excluding those countries, so that
  3554. distribution is permitted only in or among countries not thus excluded. In such
  3555. case, this License incorporates the limitation as if written in the body of
  3556. this License.
  3557.  
  3558. 9. The Free Software Foundation may publish revised and/or new versions of the
  3559. General Public License from time to time. Such new versions will be similar in
  3560. spirit to the present version, but may differ in detail to address new problems
  3561. or concerns.
  3562.  
  3563. Each version is given a distinguishing version number. If the Program specifies
  3564. a version number of this License which applies to it and "any later version",
  3565. you have the option of following the terms and conditions either of that
  3566. version or of any later version published by the Free Software Foundation. If
  3567. the Program does not specify a version number of this License, you may choose
  3568. any version ever published by the Free Software Foundation.
  3569.  
  3570. 10. If you wish to incorporate parts of the Program into other free programs
  3571. whose distribution conditions are different, write to the author to ask for
  3572. permission. For software which is copyrighted by the Free Software Foundation,
  3573. write to the Free Software Foundation; we sometimes make exceptions for this.
  3574. Our decision will be guided by the two goals of preserving the free status of
  3575. all derivatives of our free software and of promoting the sharing and reuse of
  3576. software generally.
  3577.  
  3578. NO WARRANTY
  3579.  
  3580. 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
  3581. THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
  3582. STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
  3583. PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  3584. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  3585. FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
  3586. PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU
  3587. ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  3588.  
  3589. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
  3590. ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
  3591. PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
  3592. GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  3593. INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  3594. BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
  3595. FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
  3596. OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  3597.  
  3598. END OF TERMS AND CONDITIONS
  3599.